Skip to content

Instantly share code, notes, and snippets.

View amboutwe's full-sized avatar

Angi amboutwe

View GitHub Profile
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Sync post meta to Yoast Indexable
* Credit: Yoast team
* Last Tested: Dec 20 2022 using Yoast SEO 19.13 on WordPress 6.1.1
*/
// The ID of the post to modify
$post_id = 1;
@amboutwe
amboutwe / yoast_seo_dashboard_widget_remove.php
Last active November 16, 2023 00:43
Remove Yoast SEO Dashboard Widget
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Dashboard Widget
* Credit: Unknown
* Last Tested: Sep 15 2022 using Yoast SEO 19.6.1 on WordPress 6.0.2
*/
add_action('wp_dashboard_setup', 'remove_wpseo_dashboard_overview' );
@amboutwe
amboutwe / yoast_seo_admin_user_remove_social.php
Last active November 1, 2023 22:59
Remove Yoast SEO Social Profiles From All Users
/* Remove Yoast SEO Social Profiles From All Users
* Credit: Yoast Developers
* Last Tested: Nov 01 2023 using Yoast SEO 21.5 on WordPress 6.3.2
*********
* Use this code to hide the fields shown under Admin > Users > Edit user
* Previously entered profiles will be included in schema
* To limit or remove user schema, use 'wpseo_schema_person_social_profiles' filter
* Link: https://developer.yoast.com/features/schema/pieces/person/#social-profiles
*/
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Disable Yoast SEO Emoji Script
* Credit: Yoast team
* Last Tested: Oct 24 2023 using Yoast SEO (free and premium) 21.4 on WordPress 6.3.2
*/
add_filter( 'wpseo_premium_load_emoji_picker', '__return_false' );
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change the pagination limit for the Yoast SEO bulk editor
* Credit: https://github.com/emmelemme
* Last Tested: Aug 08 2023 using Yoast SEO 20.12 on WordPress 6.2.2
* Default = 10 items per page
*/
add_filter('wpseo_posts_per_page', function($number){
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove the datePublished from the Yoast SEO meta tags
* Credit: Yoast team
* Last Tested: Jul 27 2023 using Yoast SEO 20.12 on WordPress 6.2.2
*/
function remove_date_metatags ( $presenters ) {
return array_map( function( $presenter ) {
@amboutwe
amboutwe / yoast_seo_prev_next_change.php
Last active July 7, 2023 19:54
Remove or modify the Yoast SEO prev or next URLs. Only copy the section of code you need.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change Yoast SEO Prev/Next URL on some pages
* Credit: Yoast Team
* Last Tested: Jun 10 2017 using Yoast SEO 4.9 on WordPress 4.8
*/
add_filter( 'wpseo_next_rel_link', 'custom_change_wpseo_next' );
@amboutwe
amboutwe / yoast_seo_breadcrumb_remove_static_blog_page_only.php
Created May 12, 2021 22:46
Remove Yoast breadcrumb from static blog page
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast breadcrumb from static blog page
* Credit: Yoast team
* Last Tested: May 12, 2021 using Yoast SEO 16.2 on WordPress 5.7.1
*/
add_filter( 'wpseo_schema_webpage', 'remove_breadcrumb_schema_ref', 10, 1);
function remove_breadcrumb_schema_ref( $piece ){
@amboutwe
amboutwe / yoast_seo_title_add_separators.php
Last active September 24, 2022 08:40
Add custom separators to the Yoast SEO options
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Add custom separators to the Yoast SEO options
* Credit: Yoast team
* Last Tested: September 2, 2021 using Yoast SEO 17.0 on WordPress 5.8
*/
add_filter( 'wpseo_separator_options', 'yoast_seo_title_add_separators', 10 , 1 );
@amboutwe
amboutwe / yoast_seo_title_change-variable.php
Last active May 23, 2022 17:09
Change existing or add custom title or meta template variables
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Change existing title or meta template variable
* Credit: Moshe Harush
* https://stackoverflow.com/questions/36281915/yoast-seo-how-to-create-custom-variables
* Last Tested: Unknown
*/
// define the wpseo_replacements callback
function filter_wpseo_replacements( $replacements ) {