• I am trying to remove the nav links for a particular post category, I have tried this:
    function your_prefix_next_prev_links( $status ) {

    if ( ‘staff’ == get_post_type() ) {
    $status = false;
    }

    return $status;
    }

    add_filter( ‘astra_single_post_navigation_enabled’, ‘your_prefix_next_prev_links’ );

    but it doesn’t work. I tried it with get_the_category as well but no luck. I’m stuck now, any help appreciated.

    Tony

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

Viewing 1 replies (of 1 total)
  • Hi @mactonex,

    Sorry for the delay.
    ?
    Would you please try adding this custom PHP code to your site

    add_action('wp', 'pagination_callback');
    function pagination_callback(){
        $category_name = get_the_category(get_the_ID());
        if( $category_name[0]->name === 'Nature' ){ 
            add_filter('astra_single_post_navigation_enabled', '__return_false' );
        }
    }

    ?Please change Nature to your actual category.

    ?I hope that will help. Feel free to reach out to us if you have any further queries.

    ??Kind regards,
    ?Herman ??

    ??P.S. We recommend reaching out to us through our Support Portal for faster help and resolution as mentioned here.

Viewing 1 replies (of 1 total)
  • The topic ‘How to remove Previous post and Next Post Link from specific post category’ is closed to new replies.