MyListing Club

Remove Hyphens in Two-Worded Slugs for SEOPress

Building better MyListing websites. One code snippet at a time.

Overview

The Remove Hyphens in Two-Worded Slugs for SEOPress 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”.

Implementation

  1. Grab the code snippet.
  2. Follow the provided instructions.
  3. Save your changes.
				
					//// INSTRUCTIONS: 
//// Copy and paste the code snippet below into the child theme's functions.php file.
//// You can edit the functions.php file from your WordPress dashboard (Appearance > Theme Editor) or via FTP.

--------------------------- CODE SNIPPET IS BELOW THIS LINE --------------------------- 

// REMOVE HYPHENS IN TWO-WORDED SLUGS FOR SEOPRESS
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);
});