Yoast Seo Plugin – Set no-index to a post automatically when a post is set to sticky [closed]

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

help to write a custom php script to settingup yoast priority to pages or posts

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

WP-RestAPI and xml sitemap

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

With the Yoast SEO plugin, is it possible to make the meta description a required form field?

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

Post content blank after disabling Yoast SEO

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

How to parse Yoast SEO Snippet Variables

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)