Articles of rewrite rules

Remove rewrite endpoint on deactivation?

I’m using Milo’s answer to add a Rewrite Endpoint as part of my plugin. Is there a straight-forward way to remove a Rewrite Rule upon deactivation? I found this snippet but I’d expect a “remove_rewrite_endpoint” to match add_rewrite_endpoint Also, how do I know what to look for in the rewrite rules list when add_rewrite_endpoint was […]

How do I turn off the blog and archives?

Is there a fixed set of htaccess rewrite rules I can use to “turn off” everything blogging related? It’s not enough to just not show the links in the menu, I want to completely hide everything related to the blog part, including blog posts, archives, tag and category pages. So people or robots can’t come […]

Custom Post Type won't Register

I’m hoping one of you WP gurus can spot what I am missing. I have a CPT that won’t register for some reason. It’ virtually identical to another CPT that is registered just fine. I have a custom post type for cartoon-series with a special-features cpt to go with it. Then I have a movies […]

Using category slug in add_rewrite rule

I’m using this function ro rewrite URLs: function archive_rewrite_rules(){ add_rewrite_rule( ‘inspiracao/([^/]*)/([0-9]{4})/?$’, ‘index.php?post_type=post&cat=$matches[1]&year=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘archive_rewrite_rules’ ); But is possible to use category slug instead category id?

Rewrite URL in address bar for a specific page

My client has purchased a new “vanity” domain name that they want to use to forward peoplle to a specific page I’ve set up on their wordpress site. I’ve set up web forwarding on the new domain so it’s going to the right page. e.g. now goes to HOWEVER, the client wants the […]

Rewrite rules ignored

Why are my rewrite rules being ignored by WordPress? I’ve got the following rule added: news/([0-9]{4})/?$ archive-news.php?year=$matches[1] but the URL news/2015 gives a 404. Why?

WordPress rewrite rules not working

I have created a plugin and i have gotten rewrite rules to work using my .htaccess file. I would like to make this work from my plugin instead to keep everything contained from within there. Im trying to do this via the wordpress rewrite but nothing i do it working with this. I have even […]

Pagination for custom post types – url rewriting

I’m working with custom post type, that I want to paginate, here’s part of code, initializing custom post type: $args = array( ‘labels’ => $labels, ‘public’ => false, ‘publicly_queryable’ => true, ‘show_ui’ => true, ‘show_in_menu’ => true, ‘query_var’ => true, ‘capability_type’ => ‘post’, ‘has_archive’ => true, ‘hierarchical’ => false, ‘menu_position’ => null, ‘supports’ => array(‘title’, […]

How to change the displayed URL?

I’d like URLs like this: be rewritten and displayed to a URL like the one below: At the moment, the two URLs point to the same resource so there is no difference between them on the site apart from how they look like. I’d like wordpress to display the shorter version. How can […]

Rewriting in wordpress url

Yes we love to make the url more shorter ,more clean. Lets say we have css url like this However i would love to display it like this So i think rewriting is best choice. I created a plugin made a new file rewrite.php and included the file and inserted code in rewrite.php […]