Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Lauren Briskin

Filter on shortcode?

This plugin is great. I’m wondering, though, if there are options I’m missing with the shortcode setting? I don’t seem to be able to filter, and I’d really like to so that I can find all the posts that don’t have a shortcode. Thanks!

1 year, 8 months ago
Stefan van den Dungen Gronovius

Hi Lauren,

Thanks for your feedback.
Filtering out posts without a shortcode would not be very efficient, and that is the reason that there is no way to do that for this specific column.

You could try add the Content column and filter post that does not contain ‘[‘ although this is still global.
If you want to filter out posts with a specific shortcode, you could make the search query a bit more specific like:
does not contain ‘[gallery’

Hopefully this will help you with your use case.

1 year, 8 months ago
Lauren Briskin

Thanks, Stefan. Can you tell me a little bit more about why it wouldn’t be efficient? Do you mean from the dev side or the end user?

I’ll try your tips.

For use case: I insert a map in each post using a shortcode, but I didn’t start doing this immediately on launching my site 15 years ago. There are over 4k posts, and finding which one has that shortcode and which doesn’t is immensely time consuming. It would be great to filter all of the posts that don’t have a shortcode so I can edit those directly rather than hunting and pecking through all 4k posts.

I can also see this being useful were I to change shortcodes. When you delete a reusable block, it goes away from all of the posts where it was used. I would want to (and may do if I change mapping tools) identify which posts were using that shortcode so I’d know which to edit prior to deleting that shortcode and/or reusable block.

I hope that’s helpful and I’ll take a look at your tips later today.

1 year, 8 months ago
Stefan van den Dungen Gronovius

Sorry, I do mean that wring an SQL query is heavy on performance. Aside from that, the shortcodes column is an aggregated column that just parses the content for each visible post showing what shortcodes are used on the page. Searching for posts that are using specific shortcodes is a different story.

I understand what you’re trying to do, but using my earlier-mentioned workaround is for now the only option for you at this moment. To be more specific for your use case, let’s assume that your shortcode looks something like this:

[mapshortcode custom=”property”]

If you add the ‘Content’ column to your page, you can then use Smart Filtering to filter on:
Does not contain ‘[mapshortcode’ and it will find all the posts that does not contain that shortcode in the content field.

1 year, 8 months ago

You must be logged in to reply to this topic.