I am trying to modify the URL structure of my client’s website. I am using add_rewrite_rule() function. But it does not get effected.
I added this function
add_action( ‘init’, function() {
add_rewrite_rule( ‘searchlawyers/([a-z0-9-]+)[/]?$’, ‘index.php?searchlawyers=$matches[1]’, ‘top’ );
} );
This is the current structure of URL : https://www.lexinter.net/searchlawyers?address%5B%5D=&post%5B%5D=job_listing&tax%5Bjob_listing_category%5D%5B%5D=&distance=200&units=imperial&page=1&paged=1&per_page=20&lat=&lng=&country=&form=1&action=fs
I want to modify this url like https://www.lexinter.net/new-york/personal-injury-lawyer
How can I achieve this?
Muhibul Haque is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.