Site logo

Archived topic

Insert PHP to Hook

1 reply · Started by Felix on February 3, 2021

Viewing posts 1–2 of 2

hey Team!

some time ago i put some php to a hook and it worked pretty well.

<?php $terms = get_the_terms( $post->ID , 'category' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'category' );
if( is_wp_error( $term_link ) )
continue;
echo '' . $term->name . '';
}
?>

now i have tried it again with the same snip and get this error:

Invalid argument supplied for foreach() in /Local Sites/generate-press-test/app/public/wp-content/plugins/gp-premium/elements/class-hooks.php(196) : eval()'d code on line 13

any suggestions? maybe there is a better way to archive my plan. :)

Thanks

This archived topic is closed to new replies.