Error 500
-
Hi. I keep getting either: “The snippet has been deactivated due to an error on line 4: syntax error, unexpected ‘$html’ (T_VARIABLE)”, or an error 500 when I add the following snippet:
add_shortcode('post_cats', 'sa_show_cats'); function sa_show_cats() { $cats = wp_get_post_categories( get_the_ID(), ['fields'=>'all',]); $html = array(); foreach ( $cats as $cat ) { $url = site_url("/category/{$cat->slug}/"); $html[] = "<a class=\"sa-cat-links\" href=\"$url\">{$cat->name}</a>"; } return implode( $html, ', '); }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Error 500’ is closed to new replies.