The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Dashboard - View Post By Category not sorting by category (1 post)

  1. jettison
    Posted 7 years ago #

    I have add this function to function.php to exclude a category from the front page and the archives:

    function exclude_category($query) {
    if ( $query->is_home || $query->is_archive) {
    $query->set('cat', '-10005');
    return $query;
    add_filter('pre_get_posts', 'exclude_category');

    But now in the dashboard when I try to view my posts by category they don't sort properly. I know that the code above is affecting it because when I remove $query->is_archive code from function.php the sort post by category works properly in the dashboard.

    Also with that code above included in function.php the link does not work it just shows all the posts and I would have to manually type in a new url for it to sort properly.

    The Url does not work with code implemented:

    But if I manually change it to:

    It works with the code implemented.


Topic Closed

This topic has been closed to new replies.

About this Topic