WordPress.org

Forums

Search by ID
Multiple Search Results for Low IDs (3 posts)

  1. nsisler
    Member
    Posted 11 months ago #

    Thanks for the plugin! It works great, except when I'm trying to search for some posts that have only 2 digit ids a few different posts are returned, presumably because those have a matching set of digits in the id. Is there a way to search so that I only get the exact post I'm looking for?

    https://wordpress.org/plugins/search-by-id/

  2. Uffe Fey
    Member
    Plugin Author

    Posted 10 months ago #

    That sounds odd. The way it works is this:

    1) If the input is entirely numeric, it will look for the post with that exact ID.

    2) If the input is not entirely numeric (for instance "100,200"), it will look for all posts with those IDs (in this example, 100 and 200).

    In either case, it is an exact match (not a "like" match). However, the ID criteria is appended to the query, which may explain why you're seeing that behaviour. For instance, if you're filtering by post status and have entered an ID at the same time, the actual query will look something like this:

    select .. from .. where post_status = [status] or ID = [id]

    Or perhaps you have other active plugins that alters the query in some way?

  3. Uffe Fey
    Member
    Plugin Author

    Posted 10 months ago #

    Sorry about the late reply, btw :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.