Hi, thank you very much!
It works!
5 stars already rated.
Hi, unfortunately this code (I don’t understand why) creates backend low loading.
When I remove this feature, my site is back up and running.
@marcorroma replace that code by this one and check if it solves the issue
add_action( 'wpel_before_apply_link', 'exclude_by_cat' , 10, 1 );
function exclude_by_cat($link_object) {
if(!is_admin()) {
// Add cat ids you want to exclude
$cat_id_to_ignore = array(1, 2, 3, 4);
$url = $link_object->get_attr( 'href' );
$post_id = url_to_postid($url);
$category_detail=get_the_category( $post_id );
if (sizeof($category_detail) > 0 && in_array($category_detail[0] -> cat_ID, $cat_id_to_ignore)) {
$link_object->set_exclude();
}
}
}
No, it creates problems!
When I activate this function. I delete my site’s cache and cookies. I can’t access the login page, please keep loading the page.
The moment I remove your php code from fuctions.php, everything is back online.
-
This reply was modified 5 years, 8 months ago by
marcorroma.