Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1029092

    Hi!

    I’m building a website where small parts of texts plus an image are created as portfolio items, and used in a page in a portfolio grid. When I’m performing a search on the site, all the individual portfolio items are also visible and I would like to hide those. I’ve placed some links in the private section.

    I’ve tried using https://kriesi.at/support/topic/remove-portfolio-category-from-search-results/ but that did not do the trick. I have changed the name of the Portfolio items base, but using the new name instead of ‘portfolio’ did not help: http://up.strila.nl/b7b634

    Can you help me in hiding the portfolio items from showing up in the search results?

    Thanks!
    Daniel

    #1029926

    Hey Daniel,

    Have you tried this code?

    Remove portfolio category from search results?

    If you need further assistance please let us know.
    Best regards,
    Victoria

    • This reply was modified 6 years ago by Victoria.
    #1029933

    Hi Victoria,

    That is indeed the exact same URL as I’ve posted in the first post. So yes, I need further assistance :)

    Regards,
    Daniel

    #1031489

    Hi,

    Thank you for the update.

    The following snippet should help. Just add it in the functions.php file:

    // exclude images from search results
    add_action( 'init', 'exclude_portfolio_from_search_results' );
    function exclude_portfolio_from_search_results() {
    	global $wp_post_types;
    	$wp_post_types['portfolio']->exclude_from_search = true;
    }

    Best regards,
    Ismael

    #1041301

    Hi Ismael,

    I’ve tried the code above, but still seeing portfolio items in the search results. See the link in the private section.

    Hope you can help!

    #1041597

    Hi,

    Which ones of those items are portfolio? I can only see pages when I use the “marrakech” keyword.

    Best regards,
    Ismael

    #1041644

    Hi Ismael,

    I’ve posted another, more clear, search result, where the results 1,2,3,5,6,7 and 8 link to portfolio pages.

    edit: I did change the settings for Portfolio items in /wp-admin/options-permalink.php, I don’t know if that makes a difference?

    • This reply was modified 5 years, 11 months ago by Daniel.
    #1041975

    Hi,

    Thanks for the update. Try this filter instead:

    
    add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod');
    function avf_portfolio_cpt_args_mod($args) {
    	$args['exclude_from_search'] = true;
    	return $args;
    }

    Best regards,
    Ismael

    #1042017

    This works, thanks Ismael!

    #1042342

    Hi,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1042783

    You can close the topic, thanks!

    #1042906

    Hi,

    Awesome! Glad we could help!

    Please take a moment to review our theme and show your support https://themeforest.net/downloads
    Don’t forget to bookmark Enfold Documentation for future reference.

    Thank you for using Enfold :)

    Best regards,
    Ismael

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Hide all portfolio items from internal search results’ is closed to new replies.