• Resolved webnik

    (@bambo)


    I have noticed that content from instruction posts turns up using default WP search – don’t think that is a good feature. Wanted it gone but ran in to a massive amount of google hits about Custom Post Types. From that it seems manipulating search form is the way to go. Not interesting I think. So I ended up here http://codex.wordpress.org/Function_Reference/register_post_type and noticed

    ‘exclude_from_search’ => true,

    Aha. But how to fix that AFTER plugin is installed/already registered? Can you do that? Can anyone? I can’t figure it out. What I can figure out is to uninstall, remove all traces in sight and then add that line manually to bei_post_type.php After reinstall content seems to be hidden from search.

    I think I should do better testing, like on default theme and what not, but seems like a reproducible issue to me – until proven wrong 🙂

    http://wordpress.org/extend/plugins/back-end-instructions/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Doodlebee

    (@doodlebee)

    Thanks for this – I didn’t even think about this when I wrote the plugin. I’m getting ready to release the next version – I’ll address this in it.

    Plugin Author Doodlebee

    (@doodlebee)

    Here’s a temporary solution for your search results page: at the beginning of the Loop, where it says “while(have_posts()) : the_post();“, put the following in under it:

    if($post->post_type == 'instructions') continue;

    This will look at the post type of each result, and if it’s an instruction, it won’t pull it into the search results.

    This is temporary though – there are issues that could crop up, mainly with pagination (because if you have your results set to 10 before pagination, and you have 11 results – one of them being an instruction – it’ll *display* the proper 10 results, but show there’s a page 2, which will either result in a 404 or the same plage displayed again.)

    but that’s a temporary fix that should get you through “in the meantime” while I sort out how to interfere in the query.

    Thread Starter webnik

    (@bambo)

    Nice, look forward to update. Not a crucial issue for me right now but temp fix might be relevant to some live sites.

    If you find a way to simply disable inclusion in search result for existing post type, also existing content, then don’t hesitate to post. From my searches it seems to be decided once and for all during registration, can’t just go back and forth. Exclusion fixes are of the nature you posted.

    Plugin Author Doodlebee

    (@doodlebee)

    Yeah, it’s pretty much what you said – I just needed to disable it from search when I set up the custom post type. I did quite a bit of testing, and it’s working just fine now. Absolutely does not show up in search. (I haven’t released it yet, though, because there’s a bunch of other stuff I’m trying to work in as well. Nothing like being late!) I’m almost done though – I leave for vacation this weekend, so I’m trying to get it fixed up and pushed out before I leave.

    Thanks again for letting me know! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Back-End Instructions] Instructions turns up in search’ is closed to new replies.