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.
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 3 years, 9 months ago by
srsimonson.
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.