How to solve Robots.txt problem with WordPress fresh install?

Your robots file as of right now: User-agent: Googlebot Disallow: User-agent: * Disallow: Disallow: /cgi-bin/ Disallow: /wp-admin/ Disallow: /wp-includes/ Sitemap: http://www.yadfaeq.com You aren’t specifying anything for Googlebot so you should remove it. Additionally, Disallow: could be interpreted as Disallow: / which would block your entire site. What your robots file should be: User-agent: * Disallow: … Read more

Add meta value to custom post type on publish

You are usgin an undefined $post->ID variable because there is no reference to any $post object in your code; instead, use the $post_ID variable retrieved in the function: function on_jobs_publish( $post_ID ) { global $wpdb; $wpdb->insert( ‘iCrewzWp_postmeta’, array( ‘post_id’ => $post_ID, ‘meta_key’ => ‘_yoast_wpseo_sitemap-include’, ‘meta_value’ => ‘always’ ), array( ‘%d’, ‘%s’, ‘%s’ ) ); } … Read more

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