Get WPFTS Pro today with 25% discount!

  • When you ever try to search WordPress posts or pages by shortcode content inserted to posts, you should notice that it's a not trivial task!

    Simply say, it's not possible for the native WordPress search. And you even can not solve this by simple PHP code. But why? Well, let me explain to you in detail.

    Shortcodes are tags like [the_shortcode] included in the post content. Lots of plugins use this technique to insert their custom (and sometimes quite complex) content into the post, and this powerful functionality really makes the difference to us!

    But why we can't search in that generated content? Because the shortcode content is never stored in the database. Instead, only the [the_shortcode] string is stored. WordPress page generation function is creating the text for shortcodes "on the fly". But native WP search is working with the database data!

    Okay... so it's not possible, right?

    No way! Since the WPFTS plugin is indexing, it does provide the ability to store "generated" shortcode content in the search index together with the post content! And thus, posts/pages become searchable by the shortcode content!

    Let me give you an example.

    Assume we have a post with the content like this:

    The cats always have their wonderful and useful devices like [cats_devices].

    As you can see, this content has the shortcode, which will be replaced by the string "fluffy paws, long tail, furry back, and purr" on the page generation stage. But only the initial content will be stored in the database.

    Assume you want to find this post by the word "tail" using an integrated WP search. You will find... nothing!

    Now listen, what the WPFTS plugin does: at the moment when you save your post, it renders the post content as it should look on the frontend - with all these shortcodes rendered and then store the result in the search index!

    Later, when you're trying to search for the word "tail", it will return the post ID, because it knows - the "tail" will be on the page!

    E20201119-051309-001[1].png

    And even more - this full phrase will be shown in the Smart Excerpt. Cool, right?

    The respective option was added to the WPFTS Settings / Indexing Engine / Indexing Defaults tab and it is enabled by default, but who knows, just be sure you have this enabled to use this cool feature!

    E20201119-045918-001[1].png

    You don't need for Pro version to try this cool functionality: shortcode content search is available in the basic (free) version of WPFTS.

    Hope this post made your day. Or an hour. Or at least minute 🙂

Suggested Topics

Be the first to read the news!

We are always improving our products, adding new functions and fixes. Subscribe now to be the first to get the updates and stay informed about our sales! We are not spammy. Seriously.

Join Us Now!

We are a professional IT-team. Many of us have been working in a Web IT field for more than 10 years. Our advanced experience of software development has been employed in the creation of the WordPress FullText Search plugin. All solutions implemented into the plugin have been used for 5 or more years in over 60 different web-projects.

We are looking forward to your comments, requests and suggestions in relation to the current plugin and future updates.

ewm-logo-450

The forum powered by NodeBB | Contributors