• Resolved srsimonson

    (@srsimonson)


    Does this plugin write to the DB, and if so, which table can I query to find which pages do and don’t have the Search Exclude checked? Something like:

    SELECT * FROM postmeta WHERE meta_value LIKE ‘%search-exclude%’;
    or
    SELECT * FROM posts WHERE search_exclude = ‘visible’;

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor pronskiy

    (@pronskiy)

    An array of excluded posts ids is stored in wp_options table, in a row with option_name == ‘sep_exclude’.

    If you need this array in PHP code, the best option would be to use the following function:

    
    $excludedPostIDs = get_option('sep_exclude', []);
    

    On DB level, you could do a following query: SELECT option_value FROM wp_options WHERE option_name = 'sep_exclude' LIMIT 1. However, this will return you a sterilized string. So not sure if you can use it directly in SQL.

    Would you like to tell me more about your use case? I might suggest a better approach.

    Thread Starter srsimonson

    (@srsimonson)

    Thank you for the quick response, this was helpful! The purpose is to generate reports about URLs. One of the columns would be which pages have Search Exclude visible/hidden, so ideally writing a JOIN on the post.id. As you said, the sterilized JSON would be pretty limiting. It could be parsed out, but that would be not worth the effort for the few URLs we’re talking about. Thanks again!

    • This reply was modified 2 years, 7 months ago by srsimonson.
    Plugin Contributor pronskiy

    (@pronskiy)

    Yeah, I guess doing two separate queries would make more sense. I mean first, get the array of ideas, and second, with NOT IN operator.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Queryable in WP DB?’ is closed to new replies.