How to add gallery slug to attachment url?

So I was able to make it work (without .htaccess as Tom sugested) using WordPress Rewrite API. Here is my working code (from functions.php): function add_rewrite_rules( $wp_rewrite ) { $new_rules = array ( ‘(the-gallery-slug)\/(.?.+?)(?:/([0-9]+))?/?$’ => ‘index.php?pagename=$matches[2]’ ); // Always add your rules to the top, to make sure your rules have priority $wp_rewrite->rules = $new_rules … Read more

Dynamic content and rewrite URLs

I would suggest the use of the Insert PHP plugin: https://fr.wordpress.org/plugins/insert-php/ You would have to bind the URL path as a $_GET parameter in the .htaccess using RewriteCond/RewriteRule (if you want to keep your URL structure) or use a structure that is something like domain.com?city=New York. In your WordPress post, you’d be able to include … Read more

Need help adding rewrite rules to page

You Can follow below step : 1) Login to wp-admin 2) Goto the setting in sidebar menu Into permalinks 3) “Common Settings” In select the Post name and “Product Permalinks” automatically set like /product/sample-product/ I hope it’s useful.