During working on a WordPress project client asked me to remove the slug form the custom post type which is necessary for SEO. To do that I did some Google and got an solution which I am sharing with you here….

First register custom post type on your function.php . In my case I used property as custom post type….


Now you will need to add a hook on post_type_link filter and remove the slug using str_replace on the permalink.


Now if you open a single post type you will get 400 error. It is because  WordPress doesn’t recognize that post as a custom post type anymore. To resolve this issue we need to do another hack that is provided below……….