Hi,
We’ve built a large site with Enfold and have numerous pages that are reached by using a portfolio grid. Each portfolio item is set up with a redirect (set from within the portfolio item option ‘define custom link’) to the specific page.
When these items show up in the search results, the resulting click leads to the blank portfolio page and not the page set as the custom link.
Any help really appreciated :>
Many thanks,
Jon.
Hi Jon!
By search results you mean site search results or google search results?
Best regards,
Josue
Hi Josue,
Search results within the site itself. I’ve had a further look and if a custom link to an internal page is used in a portfolio item then the search result is duplicated in that the portfolio item AND the page appear in the search results. The page links fine directly to the page but the portfolio item in the search results links to the blank portfolio page.
So, I need to either find a fix for the blank portfolio pages OR find a way of removing portfolio items from search results (the latter is preferable).
Thanks very much for your help,
Jon.
Hi!
Please add this code to the enfold/functions.php or child theme functions.php file to remove the portfolio post type from the search results:
function remove_post_type_page_from_search() {
global $wp_post_types;
$wp_post_types['portfolio']->exclude_from_search = true;
}
add_action('init', 'remove_post_type_page_from_search');
Cheers!
Peter
Hi Peter – sorry for the late response – that worked a treat – thank you :)