Skip to content

Instantly share code, notes, and snippets.

@amboutwe
Last active September 24, 2022 08:40
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amboutwe/6ed67899af7eb17fec4ece326d10c4af to your computer and use it in GitHub Desktop.
Save amboutwe/6ed67899af7eb17fec4ece326d10c4af to your computer and use it in GitHub Desktop.
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 );
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