Last active
September 24, 2022 08:40
-
-
Save amboutwe/6ed67899af7eb17fec4ece326d10c4af to your computer and use it in GitHub Desktop.
Add custom separators to the Yoast SEO options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); | |
function yoast_seo_title_add_separators ( $currentSeparators ) { | |
$addSeparators = []; // Do not remove this line | |
array_push( $addSeparators, "★" ); // Repeat to add another separator | |
array_push( $addSeparators, "|" ); // Repeat to add another separator | |
array_push( $addSeparators, "~" ); // Repeat to add another separator | |
//Do not remove the lines below | |
$newSeparators = array_unique( array_merge( $currentSeparators, $addSeparators )); | |
return $newSeparators; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment