• I have the following code in my functions.php to enable setting categories for pages:

    `
    add_action(‘init’, function () {
    register_taxonomy_for_object_type(‘category’, ‘page’);
    });
    add_action(‘pre_get_posts’, function ($wp_query) {
    if ($wp_query->get(‘category_name’)) $wp_query->set(‘post_type’, ‘any’);
    });
    `

    The line if ($wp_query->get('category_name')) $wp_query->set('post_type', 'any'); will result in an error in combination with this plugin.

    https://ww.wp.xz.cn/plugins/breadcrumb-navxt/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Error when having pages with categories’ is closed to new replies.