• Resolved Flickreel

    (@flickreel)


    Hi there,

    I can’t tell if this is a bug, or if I have implemented the following code incorrectly. For clarity, I’ve added this to the end of my theme’s functions.php file:

    add_filter( ‘wpseo_xml_post_type_archive_priority’, ‘my_custom_post_type_archive_xml_priority’, 10, 3 );
    function my_custom_post_type_archive_xml_priority( $return, $type, $post) {
    if ($type == ‘news’)
    $return = 0.8;
    return $return;
    }

    I would expect that to override the Priority for ‘news’ on the category sitemap: http://www.flickreel.com/category-sitemap.xml – but it would appear that it has no effect. In fact, having tried all of the code in this tutorial (under the heading ‘Change Yoast SEO Sitemap Priority’): http://chykalophia.com/wordpress/change-yoast-sitemap-frequency-and-priority/ – nothing on there seems to have any effect.

    Not being able to manually set the priority(/frequency) of category pages, etc. within the WordPress SEO plugin settings does seem to be quite a severe limitation with the plugin. Google appears pretty confused with the way that it displays deep links for the site (when it does actually show them). Often prioritising a page such as ‘Contact’ over a page such as ‘News’ or ‘Reviews’, which obviously isn’t ideal.

    Thanks for any help,
    Theo.

    https://wordpress.org/plugins/wordpress-seo/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The filter that you are attempting to use applies to the main URL only (or some variation of it). There’s another filter for posts/pages. Currently, there is not a filter that adjusts taxonomies like categories or tags.

    The priority of categories is based on the number of posts in that category. The more posts assigned to the category, the higher the priority. Publishing more into a category is going to push this number up for you. This allows the plugin to dynamically respond to changes in your publishing patterns over time and for Google to be pointed to topics that you are spending a lot of time on.

    Thread Starter Flickreel

    (@flickreel)

    In fact, it is possible to change any of these with filters. Here is the code for anyone who would like to see how:

    add_filter( 'wpseo_xml_sitemap_post_priority', 'my_custom_post_xml_priority', 10, 3 );
    
    function my_custom_post_xml_priority( $return, $type, $post) {
        if ($type == 'page')
            $return = 0.2;
        return $return;
    }
    
    add_filter( 'wpseo_sitemap_entry', 'my_custom_term_priority', 10, 3 );
    
    function my_custom_term_priority( $url, $type, $term) {
        if ($type == 'term') {
    		if($term->slug == 'news' || $term->slug == 'reviews' || $term->slug == 'trailers') {
                $url['pri'] = 0.8;
                $url['chf'] = 'daily';
    		} else if ($term->slug == 'previews' || $term->slug == 'features') {
                $url['pri'] = 0.8;
    		}
        }
        if($type == 'user') {
            $url['pri'] = 0.4;
            $url['chf'] = 'weekly';
        }
        return $url;
    }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Sitemap Priority Filter – Bug?’ is closed to new replies.