Skip to content

Instantly share code, notes, and snippets.

View amboutwe's full-sized avatar

Angi amboutwe

View GitHub Profile
@amboutwe
amboutwe / yoast_seo_sitemap_exclude_taxonomy.php
Last active July 29, 2018 13:13
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.
<?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_replytocom.php
Last active July 29, 2018 18:43
By default, Yoast SEO removes `?replytocom` variables from URLs. This can be reversed with the following code.
<?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' );
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Include empty terms in the sitemap
* Credit: Yoast team
* Last Tested: Mar 22 2019 using Yoast SEO 10.0.1 on WordPress 5.1.1
*/
add_filter('wpseo_sitemap_exclude_empty_terms', '__return_false');
@amboutwe
amboutwe / yoast_local_label_change_phone_2.php
Last active December 27, 2019 18:03
Change labels for select items in Yoast SEO Local
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Yoast SEO Custom label for Business Phone 2
* Credit: Yoast development team
* Last Tested: Apr 28 2017 using Yoast SEO Local 4.6 on WordPress 4.7.4
*/
add_filter( 'wpseo_local_contact_details', 'yoast_local_label_change_phone_2', 10, 1 );
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Disable jquery / JavaScript in Yoast SEO Local
* Credit: Bill Erickson https://www.billerickson.net/
* Last Tested: Unknown
*/
add_filter( 'wpseo_local_load_jquery', '__return_false' );
@amboutwe
amboutwe / yoast_seo_breadcrumbs_replace_woocommerce_storefront.php
Last active September 7, 2020 17:28
There are two sets of code in this gist; one for the Twenty Nineteen theme and another for the Storefront theme. These are to be used as an example as you or your developer may need to modify the code depending on your theme and site needs.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Replace WooCommerce Breadcrumbs With Yoast Breadcrumbs
* Credit: Mixed
* Last Tested: Oct 09, 2019 using WooCommerce 3.7.1 with Yoast SEO 12.2 on WordPress 5.2.3
* Theme: Storefront v2.5.3
*/
// Remove WooCommerce Breadcrumbs - Storefront
@amboutwe
amboutwe / yoast_seo_meta_remove_dates.php
Last active October 5, 2020 08:39
Remove Date Meta Tags Output by Yoast SEO
<?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
* For Yoast SEO 14.0 or newer, please see https://yoast.com/help/date-appears-search-results/#h-managing-dates
*/
add_action('wpseo_dc_'.'DC.date.issued', '__return_false'); // Premium versions 5.2 or older
@amboutwe
amboutwe / yoast_seo_primary_category_disable.php
Last active May 3, 2021 19:35
Disable Yoast SEO Primary Category Feature
<?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_disable_single_post.php
Last active May 25, 2021 22:39
Remove Yoast from front end for a single post or page
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast from front end for a single post or page
* Credit: Dodinas https://stackoverflow.com/questions/37845968/disable-wordpress-yoast-seo-on-single-page
* Last Tested: Nov 08 2019 using Yoast SEO 12.4 on WordPress 5.2.4
* Note: For version 14+, please use the code here: https://developer.yoast.com/customization/yoast-seo/disabling-yoast-seo
*********
* DIFFERENT POST TYPES
* Post: Change 123456 to the post ID
* Page: Change is_single to is_page and 123456 to the page ID
@amboutwe
amboutwe / yoast_seo_json_remove.php
Last active July 23, 2021 08:08
Remove all JSON output by Yoast SEO
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove all JSON output by Yoast SEO
* Credit: Yoast development team
* Documentation: https://developer.yoast.com/schema-documentation/api/
* Last Tested: Apr 16 2019 using Yoast SEO 11.0 on WordPress 5.1.1
*/
add_filter( 'wpseo_json_ld_output', '__return_false' );