• Hi

    How can we add fix post fix on every page/post.

    For example

    www.example.com/page-slug/FIXED-SLUG

    or
    www.example.com/parent-slug/subpage-slug/FIXED-SLUG

    I have added below

    add_rewrite_rule('^([^/]*)/FIXED-SLUG/?' , 'index.php?pagename=$matches[1]&fixed_slug=1','top' );

    This is working for root page but this is not working for Sub level page.

    For this i have already tried
    add_rewrite_rule('^([^/]*)/([^/]*)/FIXED-SLUG/?' , 'index.php?pagename=$matches[2]&fixed_slug=1','top' );

    &
    add_rewrite_rule('^parent-page/([^/]*)/FIXED-SLUG/?' , 'index.php?pagename=$matches[1]&fixed_slug=1','top' );

    But this is not working

    • This topic was modified 4 years, 6 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    WP permalinks have a cascading logic and you’ve sort of jumped the queue by adding a final term. To do this with WP rewrite rules you’d need to override every default permalink rule where the term could be used. There are a good number of them.

    I think it’d be easier to utilize .htaccess rules to strip out FIXED-SLUG and append &fixed_slug=1 to the rewritten URL. Then the default WP rules can work with the result without further modification. Untested, but worth further investigation I think.

    Thread Starter Ashish Jangra

    (@ashishjangra-1)

    Yes I have already tried with this but the problem is sometime i need this fixed slug sometime I need sometime i didn’t not

    I mean whenever a page have form, after submission it will redirect to thank-you page .. and thank-you page will be same page where they submitted the from only difference will be like .. it will have thank-you at the end of the url.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pass URL POST Fix’ is closed to new replies.