• Resolved dilbert16588

    (@dilbert16588)


    Using this plugin, I created the new post type “Movie Reviews.” As we know by default, the WP search doesn’t include this unless I tell it to via the functions.php file. However, following the official guide here: https://docs.pluginize.com/article/23-post-type-posts-in-search-results
    and even trying the codes discussed in a couple prior support threads has not worked. There was one thread that seemed to be headed in the right direction, but that discussion went into private messaging and then was marked as resolved.

    I have already, as suggested in one of the other threads, manually added the CPT to the functions.php file – but it did not have any improvement. I’ve also already checked that the CPT ‘Movie Reviews’, which I can include detailed code for below, is public, is publicly queryable, and is not excluded from search.

    I am using the Hello Elementor Child Theme. The main theme does have a search.php file that I have not copied into the Child theme – could this be part of the hurdle? A quick glance at that shows is dealing more with the actual layout – which would be overruled by the Elementor Template. [I have disabled my template and still cannot search including the CPT btw]

    To clarify my query, as the CPT is Movie Reviews, the primary search keywords would be movie titles (so it’s not an issue with categories or taxonomies). I have tried using a keyword from two published CPT posts, but I cannot get them to show in the results. I am able to add/remove the ‘post’ and ‘page’ slugs from the various codes and that does affect the search results, so the codes are working – just not searching the CPT posts. Heck, I’ve even tried various ways of listing the slug (add underline for the space, remove the space, etc) but nothing has worked.

    Cheers!

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Thank you for your patience.

    Is an instance search field the one shown along the right side, one that I could check/test with?

    Also, the results page from that, that I’ve seen thus far, is rather unstyled. Is that from your own debugging attempts where you pasted in a template file into your child theme? Is it possible that you could remove that and let the parent take over again. Hopefully that ends up with the prettier version, that also may provide more information to use.

    Thread Starter dilbert16588

    (@dilbert16588)

    I’ve been testing most of my searches using the right sidebar search, though think I’ve also tried the one in the middle of the homepage (but not the one in the footer). I’ll triple check, but they should all be set up the same – and I can make sure that it’s set up right. [I usually used “Rent” to test the search, the latest movie review post, but I also tried “Michael” as that term should show a couple pages in addition to the movie review for “I Am Michael.”

    Yes, I had disabled my designed search results page template to make sure that it wasn’t interfering with the results query. I did copy the search.php file from the parent theme into the Child theme’s folder – but have not edited or changed it; what you’re seeing is simply the base styling of the Hello Elementor Theme. But I can activate my template page again if that would help.

    (Everything thus far is the Hello Child theme and stylized with Elementor. The only changes I have made to any files or coding was the manual add of the CPT code into the functions file and the code to try and include the CPT.)

    Thread Starter dilbert16588

    (@dilbert16588)

    Just took a quick look, ignore my comment about the middle of the page search bar – I’ve currently got that disabled because the sidebar overlaps it. (and my tired self thought the footer one was a search bar – it’s a contact form. oops!)

    The only thing I can affect in Elementor is the styling of the WP Search Form widget, so it’s not an issue of that not being set up right.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Could you share your plugins list? A quick copy/paste ready version should be accessible from CPTUI Tools > Debug Info tab. I’m wondering if something is maybe active that could be affecting things.

    Also, just to be certain, “moviereviews” is your current intended post type slug, correct? The value in the first field when you visit it in your CPTUI settings for it, and not just the “rewrite slug” field?

    Thread Starter dilbert16588

    (@dilbert16588)

    Here is the CPT info for “moviereviews”:

    name: moviereviews
    label: Movie Reviews
    singular_label: Movie Review
    description: “”
    public: true
    publicly_queryable: true
    show_ui: true
    show_in_nav_menus: true
    delete_with_user: false
    show_in_rest: true
    rest_base: “”
    rest_controller_class: “”
    has_archive: true
    has_archive_string: “”
    exclude_from_search: false
    capability_type: post
    hierarchical: false
    rewrite: true
    rewrite_slug: “”
    rewrite_withfront: true
    query_var: true
    query_var_slug: “”
    menu_position: “”
    show_in_menu: true
    show_in_menu_string: “”
    menu_icon: dashicons-tickets-alt
    custom_supports: “”

    Though I have tried every variant of that in the array, even together, and it still wasn’t searching the CPT.

    Thread Starter dilbert16588

    (@dilbert16588)

    Here’s the plugin list:

    TOTAL PLUGINS: 27

    MU PLUGINS: (1)

    Endurance Page Cache: 1.6

    ACTIVE PLUGINS: (24)

    Advanced Custom Fields: 5.8.7
    Akismet Anti-Spam: 4.1.3
    BackWPup: 3.7.0
    Broken Link Checker: 1.11.9
    Cache Enabler: 1.3.4
    Classic Editor: 1.5
    Coming Soon wp: 1.5.8
    Compress JPEG & PNG images: 3.2.0
    Contact Form 7: 5.1.6
    Contact Form 7 Extension For Mailchimp: 0.5.09
    Custom Post Type UI: 1.7.1
    Easy Updates Manager: 8.2.0
    Elementor: 2.7.5
    Elementor Pro: 2.7.3
    Envato Elements: 1.1.4
    Google Analytics for WordPress by MonsterInsights: 7.10.0
    If Menu – Visibility control for menu items: 0.15
    Jetpack by WordPress.com: 7.9.1
    Redirection: 4.5.1
    Relevanssi: 4.3.4
    Social Pug: 1.6.2
    The GDPR Framework: 1.0.33
    WP AutoTerms: 2.3.0
    Yoast SEO: 12.6.2

    INACTIVE PLUGINS: (3)

    MC4WP: Mailchimp for WordPress: 4.7.2
    SumoMe: 1.31
    WP Review: 5.2.8

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can you try things with Relevanssi disabled? That one stood out quick upon scanning the list and I know it’s related to search.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just tested on my own with a freshly activated Relevanssi and my results disappeared. Once I told the post type to get indexed and the index built, they showed up again.

    Thread Starter dilbert16588

    (@dilbert16588)

    It was Relevanssi that was holding me back – oops. I had forgetten that I had that plugin activated (and might take a review of the usefulness of it).

    I tested the search code with the plugin deactivated and the search results included the CPT. After digging a bit in the settings and rebuilding the index, looks like it’s still working.
    (And the unstyled search result page is from copying the search.php file into the child. Removed that and my template’s working as well without affecting the results).

    Think we’re good now, thanks!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Glad I could help ??

    Have a good rest of your day.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Unable to include CPT in Search Results’ is closed to new replies.