• Resolved Marks1973

    (@marks1973)


    Hello,

    I am writing to you because -even though the standard solution should be a couple of lines in functions.php- your plugin is the only thing so far that provided me with some result, even though not yet what I need.

    What I need is simply to include my only one custom post type in the search results (the default WP search).

    A BIT OF INFORMATION:

    In this custom post type I’ve added some custom fields with ACF.
    In the CPT I’ve disabled the “editor” capability, because the “content” is given by a CF.
    I’ve put the CPT in a custom plugin, which is correctly registered and activated, in fact I’ve already added some posts with this CPT.

    The CPT is registered with:

    
    'public' => true,
    'show_ui' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true
    

    In your plugin’s setting screen, all of the checkboxes in “General Search Setting”, “Select Meta Key Names” (including the custom ones), “Select Taxonomies” and “Select Post Types” (including my custom one) are checked.

    WHAT I GET:

    As stated before, I only get results related to my CPT when the search terms appear in the “Media” post type, I.E. if I add an image to my CPT; so basically it’s not even a result from my CPT since the search is done in the “Attachment” post type.

    If I don’t use your plugin and I just go for the “standard way”, I.E. adding something like
    $query->set( 'post_type', array( 'mycptname' ) );
    in functions.php, I don’t even get those results from “Attachment”, and that’s why I’m trying to ask you if you have the slightest idea of what may be occurring here.

    Thanks a lot even just for having read so far.

    Marco

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sumit Singh

    (@5um17)

    Hi,

    Sorry I am having trouble understanding the issue. Could you please post a screenshot of setting?
    Also, please let me know you have not selected attachment in post type settings still you are seeing the attachments in search results? Is that true?

    Thanks

    Thread Starter Marks1973

    (@marks1973)

    Hi Sumit,
    thanks for your reply; the thing is… my theme is written completely from scratch (and it’s maybe my first complete theme), so since your plugin works as expected with a standard theme (such as twenty-nineteen) I must think that the problem is within my theme, even though I still don’t know in which part (either the template files, or functions.php, or the plugin into which I’ve put my CPT).
    So I don’t wish to bother you further until I know better what to ask 🙂
    Thanks again,
    Marco

    Plugin Author Sumit Singh

    (@5um17)

    Hi Marco,

    Okay no problem. But I would suggest you to please check two filters. pre_get_posts and posts_search because these are two main hooks used by WPES to alter the functionality and other theme/plugins modifications using these hooks can affect the outcome of WPES.

    For now I will put this topic as resolved please reopen or submit a new one if you need help in future.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Not finding custom post type (with ACF)’ is closed to new replies.