Skip to content

Instantly share code, notes, and snippets.

Angi amboutwe

Block or report user

Report or block amboutwe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View yoast_seo_roles_remove.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO user roles
* Credit: Yoast Team
* Last Tested: Oct 25 2017 using Yoast SEO 5.7.1 on WordPress 4.8.2
*/
// Remove Yoast `SEO Manager` role
if ( get_role('wpseo_manager') ) {
remove_role( 'wpseo_manager' );
@amboutwe
amboutwe / yoast_seo_sitemap_exclude_taxonomy.php
Last active Jul 29, 2018
Sitemaps: There are two sets of code in this gist, one for a single taxonomy or for multiple taxonomies. Only copy the section you need and replace the taxonomy_slug with the actual name of the taxonomy slug to be excluded.
View yoast_seo_sitemap_exclude_taxonomy.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Exclude One Taxonomy From Yoast SEO Sitemap
* Credit: Yoast KB https://kb.yoast.com/kb/how-to-customize-the-sitemap-index/
* Last Tested: Apr 05 2018 using Yoast SEO 7.2 on WordPress 4.9.5
*********
* Please note that changes will be applied upon next sitemap update.
* To manually refresh the sitemap, please disable and enable the sitemaps.
*/
@amboutwe
amboutwe / yoast_seo_robots_add_sitemap.php
Last active Jul 29, 2018
Add the Yoast SEO sitemap index to the WordPress generated robots.txt file.
View yoast_seo_robots_add_sitemap.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Add Sitemap Index To Generated Robots.txt
* Credit: Ben https://github.com/retlehs
* Last Tested: Mar 13 2017 using Yoast SEO 4.4 on WordPress 4.7.3
*/
add_action('do_robots', 'custom_robotstxt');
@amboutwe
amboutwe / yoast_seo_replytocom.php
Last active Jul 29, 2018
By default, Yoast SEO removes `?replytocom` variables from URLs. This can be reversed with the following code.
View yoast_seo_replytocom.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Yoast SEO return `?replytocom` variables
* Credit: Yoast development team
* Last Tested: Mar 23 2018 using Yoast SEO 7.1 on WordPress 4.9.4
*/
add_filter( 'wpseo_remove_reply_to_com', '__return_false' );
@amboutwe
amboutwe / yoast_seo_primary_category_disable.php
Last active Oct 24, 2018
Disable Yoast SEO Primary Category Feature
View yoast_seo_primary_category_disable.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Disable Yoast SEO Primary Category Feature
* Credit: Yoast development team
* Last Tested: Jan 24 2017 using Yoast SEO 4.1 on WordPress 4.7.1
*/
add_filter( 'wpseo_primary_term_taxonomies', '__return_empty_array' );
@amboutwe
amboutwe / yoast_seo_dashboard_widget_remove.php
Last active Jan 16, 2019
Remove Yoast SEO Dashboard Widget
View yoast_seo_dashboard_widget_remove.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Dashboard Widget
* Credit: Unknown
* Last Tested: Jun 16 2017 using Yoast SEO 4.9 on WordPress 4.8
*/
add_action('wp_dashboard_setup', 'remove_wpseo_dashboard_overview' );
@amboutwe
amboutwe / custom_robots.php
Last active Jan 30, 2019
Filters and example code for Yoast SEO robots or WP robots.txt
View custom_robots.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Replace Disallow with Allow Generated Robots.txt
* Credit: Unknown
* Last Tested: Unknown
*/
add_filter('robots_txt','custom_robots');
@amboutwe
amboutwe / yoast_seo_sitemap_add_custom_type.php
Last active Mar 7, 2019
Filters and example code for Yoast SEO sitemaps
View yoast_seo_sitemap_add_custom_type.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Create Custom Yoast Sitemap
* Credit: Unknown
* Last Tested: Unknown
*********
* HOW TO USE
* Replace TYPE with your custom type
*/
@amboutwe
amboutwe / yoast_seo_canonical_change_home_url_slash.php
Last active Mar 29, 2019
Code snippets for the Yoast SEO canonical output
View yoast_seo_canonical_change_home_url_slash.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Add Trailing Slash to Home Canonical - Yoast SEO
* Credit: Unknown
* Last Tested: Unknown
*/
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_home_url_slash' );
function yoast_seo_canonical_change_home_url_slash( $canonical_url ) {
@amboutwe
amboutwe / yoast_seo_meta_remove_dates.php
Last active Apr 14, 2019
Remove Date Meta Tags Output by Yoast SEO
View yoast_seo_meta_remove_dates.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Date Meta Tags Output by Yoast SEO
* Credit: Yoast development team
* Last Tested: Apr 09 2019 using Yoast SEO 10.1.3 on WordPress 5.1.1
*/
add_action('wpseo_dc_'.'DC.date.issued', '__return_false'); // older Premium versions only
add_filter( 'wpseo_og_article_published_time', '__return_false' );
You can’t perform that action at this time.