Join

Remove Hyphens in Two-Worded Slugs for SEOPress

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

This code snippet fixes a slug formatting issue within a MyListing website, as described below.

For example, let’s say your Listing Type name is “Service Providers”. When using SEOPress (and perhaps other SEO plugins), the slug would appear as “service–providers”, rather than “service-providers”.

add_filter("seopress_social_og_title", function ($seopress_social_og_title) {
  return str_replace("-", " ", $seopress_social_og_title);
});

add_filter("seopress_titles_title", function ($seopress_titles_title_template) {
  return str_replace("-", " ", $seopress_titles_title_template);
});