Fix shortcode to work with Relevanssi
-
Hi! I’ve read a lot of the support requests and I just can’t quite figure out what I need to do to fix this.
I have a custom shortcode and all it does is display the tag name and tag description for all tags on a post. I specifically need the tag descriptions to be shown on the page and searchable.
This shortcode is incompatible with the Relevanssi shortcode indexing (I disabled it and found that everything else works, just this one is the issue), but I’m not sure how to fix it since I do need this data to be searchable.
Here’s the shortcode which I have in the functions.php file. I’m fairly new to PHP so my apologies if I’m missing something obvious!
function post_tags_test() { $tags = get_the_tags(); echo 'Tags: <br>'; { foreach ($tags as $tag) { echo '<p>' . $tag->name . ' ' . $tag->description . '</p><br>'; } } echo '<br>'; } add_shortcode ( 'tag_description', 'post_tags_test');
The topic ‘Fix shortcode to work with Relevanssi’ is closed to new replies.