Skip to content

Instantly share code, notes, and snippets.

Avatar

Angi amboutwe

View GitHub Profile
@amboutwe
amboutwe / yoast_seo_canonical_change_woocom_shop.php
Last active Sep 7, 2020
Code snippets for the Yoast SEO canonical output
View yoast_seo_canonical_change_woocom_shop.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change the canonical link for the shop page
* Credit: Scott Weiss of somethumb.com
* Last Tested: Jan 25 2017 using Yoast SEO 6.0 on WordPress 4.9.1
*/
function yoast_seo_canonical_change_woocom_shop( $canonical ) {
if ( !is_shop() ) {
@amboutwe
amboutwe / yoast_seo_dashboard_widget_remove.php
Last active Jan 8, 2020
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 / yoast_video_remove_yandex.php
Last active Apr 21, 2019
Remove Yandex tags from Yoast SEO Video
View yoast_video_remove_yandex.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yandex tags from Yoast SEO Video
* Credit: Yoast development team
* Last Tested: May 12 2017 using Yoast SEO Video 4.7 on WordPress 4.7.4
*/
add_filter( 'wpseo_video_yandex_support', '__return_false' );
@amboutwe
amboutwe / yoast_local_label_change_phone_2.php
Last active Dec 27, 2019
Change labels for select items in Yoast SEO Local
View yoast_local_label_change_phone_2.php
<?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 );
@amboutwe
amboutwe / yoast_seo_breadcrumb_add_woo_shop.php
Last active Aug 5, 2020
Multiple examples of how to customize the Yoast SEO breadcrumbs
View yoast_seo_breadcrumb_add_woo_shop.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page.
* Credit: https://wordpress.stackexchange.com/users/8495/rjb
* Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3
*/
add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' );
@amboutwe
amboutwe / yoast_seo_breadcrumb_remove_link.php
Last active Jul 30, 2020
Remove link from the Yoast SEO breadcrumbs site wide
View yoast_seo_breadcrumb_remove_link.php
@amboutwe
amboutwe / wordpress_robots_custom.php
Last active Sep 2, 2020
Filters and example code for Yoast SEO robots or WP robots.txt
View wordpress_robots_custom.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Replace Disallow with Allow Generated Robots.txt
* Credit: Unknown
* Last Tested: June 09 2020 using WordPress 5.4.1
*/
add_filter('robots_txt','custom_robots');
@amboutwe
amboutwe / yoast_seo_opengraph_change_image_size.php
Last active Sep 24, 2020
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
View yoast_seo_opengraph_change_image_size.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/
@amboutwe
amboutwe / yoast_seo_meta_remove_dates.php
Last active Apr 28, 2020
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' );
@amboutwe
amboutwe / yoast_seo_primary_category_disable.php
Last active Apr 17, 2020
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' );
You can’t perform that action at this time.