How to convert a Title to a URL slug in jQuery?

I’m working on an app in CodeIgniter, and I’m trying to make a field on a form dynamically generate the URL slug. What I’d like to do is remove the punctuation, convert it to lowercase, and replace the spaces with hyphens. So for example, Shane’s Rib Shack would become shanes-rib-shack. Here’s what I have so … Read more

Removing “category” from URLs then “add_endpoint()” won’t work…

For example, the original URL would be http://localhost/category/sub_category/. What I want is http://localhost/sub_category/, furthermore, I want to add an endpoint to the URL which looks like http://localhost/sub_category/endpoint/. I’ve removed the “category” from the URL successfully by following this tutorial https://jonnyjordan.com/blog/how-to-remove-category-from-your-urls-in-wordpress/ . But once I remove the “category” from the url, the add_rewrite_endpoint( ‘endpoint’, EP_CATEGORIES ) … Read more

Duplicate Category and Page URL loads Category instead of the Page

I have created a Category with the slug service, which has the permalink: https://example.com/service. and a Page with the link: https://example.com/service. In the Category service, there is a post with the link like: https://example.com/service/post1 Now the link https://example.com/service is redirecting to the Category Archive, but I want it to load the Page instead. How can … Read more

Why does WP rename similar “term name”-slugs in separate taxonomies?

I have several custom taxonomies and within two of those ( Company Categories and Photographer Categories ) I have a term that is similar. The Company Category called Boudoir and the Photographer category called Boudoir Photographers. When I created the Boudoir Photographer term in the Photographer Categories it renamed the Boudoir term in the Company … Read more

Using custom post type parent as slug

I’m currently using the plugin ‘Types Custom Post Type’ to create custom post types (I know it’s pretty easily done through functions.php but I was feeling a bit lazy!). Basically, I’m looking to have the following format for pages: /wellbean-cottage/ – the main page for a house /wellbean-cottage/things-to-do/ – a child page with information about … Read more

How to generate random numeric slugs for a custom post type?

I have this PHP code to generate a random numeric string: function generateRandomString($length = 12) { global $generatedStrings; $characters=”0123456789″; $randomString = ”; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, strlen($characters) – 1)]; } if (isset($generatedStrings[$randomString])) { $randomString = generateRandomString($length); } $generatedStrings[$randomString] = $randomString; return $randomString; } $generatedStrings = array(); foreach(range(1, … Read more