Way to change the Yoast Schema depending on post type? [closed]
Way to change the Yoast Schema depending on post type? [closed]
Way to change the Yoast Schema depending on post type? [closed]
I don’t think adding <span itemprop> to the <title> is a good idea… If you can not use any existing tags like <h1> for that, you may consider adding meta tag: <meta itemprop=”name” content=”Company Name”>. You can add this using wp_head, but keep in mind it should be within itemscope. If you really going after … Read more
It’s actually not an issue at all, it works just like it’s supposed to, be sure to submit the index sitemap though, not the individual ones, so submit sitemap_index.xml. See this screenshot for reference to show that it works:
You have two titles because Yoast adds an og:title tag, and then you add another one with your own code, what’s unexpected about this result? so remove the one you add with your code, problem solved. Facebook’s Debugger doesn’t like your page because you have two og:url tags, one added by Yoast, then another added … Read more
In my effort to solve this I discovered a great resource for wordpress hooks for the job and found the right hook wpseo_saved_postdata here. Feel free to modify the code if you think it could be better. For now, it works for me. function set_noidex_when_sticky($post_id){ if ( wp_is_post_revision( $post_id ) ) return; //perform other checks … Read more
The solution should is this: 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’) { switch ($post->ID) { case ‘8’: case ‘395’: case ‘342’: $return = 0.9; break; case ‘5’: $return = 1.00; break; case ‘620’: case ‘703’: case ‘603’: case ‘688’: case ‘695’: case ‘614’: case ‘684’: case … Read more
Let’s assume your plugin is writing to the /usr/share/wordpress/sitemap_index.xml filesystem location, but you want it can be accessed through http://www.website.com/sitemap_index.xml as if the xml file were stored in /var/www/html/sitemap_index.xml. You can use the alias directive then, available in mainstream webservers Apache and NginX: For an alias in NginX, you put this inside the server of … Read more
An alternate way to avoid empty meta description field is to set a default meta description using meta template variables in the dashboard. This article in the Yoast knowledge base explains how to do this and lists the available variables: https://kb.yoast.com/kb/yoast-wordpress-seo-titles-metas-template-variables/ Here’s what I ended up doing: Login as admin. In dashboard: SEO >Titles and … Read more
Turns out the single-post.php template was missing a call to the_post(). Since that function initializes all the postdata used by functions like the_content(), WordPress had nothing to display. As for Yoast SEO, I’m guessing it calls the_post() somewhere early on which would populate the WordPress global variables. If the theme was written with Yoast SEO … Read more
Ok here is how I parsed the snippets in case anyone else needs to know $id = get_the_ID(); $post = get_post( $id, ARRAY_A ); $yoast_title = get_post_meta( $id, ‘_yoast_wpseo_title’, true ); $yoast_desc = get_post_meta( $id, ‘_yoast_wpseo_metadesc’, true ); $metatitle_val = wpseo_replace_vars($yoast_title, $post ); $metatitle_val = apply_filters( ‘wpseo_title’, $metatitle_val ); $metadesc_val = wpseo_replace_vars($yoast_desc, $post ); $metadesc_val … Read more