Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8760939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:10:07+00:00 2026-06-13T15:10:07+00:00

I am trying to add custom rules using wordpress’s add_rewrite_rule function, but they don’t

  • 0

I am trying to add custom rules using wordpress’s add_rewrite_rule function, but they don’t work. The weird thing is that the rules are added and match my URL whenever I inspect them with the Monkeyman Rewrite Analyzer plugin.

When I try to access the page, it redirects to an incorrect location.

Here is my code:

add_rewrite_tag('%cc%','([a-zA-Z]+)');
add_rewrite_tag('%id%','([0-9]+)');

add_rewrite_rule('job-details/([0-9]+)$', 'index.php?pagename=jobs&cc=show&id=$matches[1]', 'top');

global $wp_rewrite;
$wp_rewrite->flush_rules();

As for my URLs, if I try to access the URL site.com/job-details/1 , it redirects me to /jobs/ , which is the page associated with my plugin.

Here is my .htaccess file

RewriteEngine On
RewriteBase /

RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:10:09+00:00Added an answer on June 13, 2026 at 3:10 pm

    Turned out that my script was using a custom function to grab the GET parameters via the $_REQUEST object, which was being nullified by wordpress.

    I used the following code to grab it instead.

    global $wp_query;
    $wp_query->query_vars['cc'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add custom fields to an InlineFormset using the following code, but
I'm trying to add a custom textarea in the admin area of wordpress using
I'm trying to add my_custom_function after the_content in WordPress using add_filter ('the_content', 'my_custom_function'); add_action
I'm trying to use WebDeploy to publish a website using custom MSDeploy skip rules
I am trying to add custom icons to a Shared Add-in for Microsoft Word.
I'm creating a custom WP theme and trying to add custom menus to the
I'm trying to add a custom class to the jQuery Mobile theme. The CSS
I am trying to add a custom log handler to my java application. I
I am trying to add a custom field to the user form in the
I'm trying to add a custom catalog index based on the recommendation here: http://collective-docs.readthedocs.org/en/latest/searching_and_indexing/indexing.html#custom-index-methods

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.