Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amboutwe/9b70492c3d7917a7b3b88142a930e815 to your computer and use it in GitHub Desktop.
Save amboutwe/9b70492c3d7917a7b3b88142a930e815 to your computer and use it in GitHub Desktop.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change IndexNow endpoint in Yoast SEO
* Credit: Yoast team
* Last Tested: Apr 21 2025 using Yoast SEO 24.9 on WordPress 6.8
* Available endpoints: https://www.indexnow.org/faq
*/
add_filter( 'Yoast\WP\SEO\indexnow_endpoint', 'yoast_seo_settings_change_indexnow_endpoint' );
function yoast_seo_settings_change_indexnow_endpoint () {
return 'https://www.bing.com/indexnow';
}
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change IndexNow key in Yoast SEO
* Credit: Yoast team
* Last Tested: Apr 22 2025 using Yoast SEO 24.9 on WordPress 6.8
* REQUIRED: Visit the homepage after adding the code to update the key
* Yoast SEO will create the [key.txt] dynamically
*/
add_filter( 'init', 'yoast_seo_settings_change_indexnow_key' );
function yoast_seo_settings_change_indexnow_key () {
$new_key = 'your-private-key'; // Change to your private key
//Do not remove the lines below
$options = get_option('wpseo');
$options[ 'index_now_key' ] = $new_key;
update_option( 'wpseo' , $options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment