Despite Yoast’s discouragement of using the wpseo_separator_options filter to add more separator options to the configuration page (SEO > Search Appearance), I really wanted to give it a shot so my URLs would have a neat separator that’s not commonly seen.

Hookr.io had a great breakdown of how wpseo_separator_options can be implemented. I added the PHP to a code snippet using the awesome Code Snippets Wordpress Plugin but my initial attempts had no effect on the list of available separator characters.

I finally figured out that you don’t need to alter the $separators array and return it … you just return your own array of additional separators and they will be appended. Here’s the code:

add_filter('wpseo_separator_options', function ( $separators ) {
	return ['〃', 'ί·', '✦', 'β†’', '☯'];
}, 10, 1);

Note: Yoast specifically recommends against using a separator other than what is provided in the plugin because some search engines (Google included) will strip them from the search results page.

I am going to take my chances and check my search results in a week or so.

UPDATE: I can confirm that Google doesn’t strip the 〃 character out as of 2021-09-10

5 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *