New answers tagged rewrite-rules
0
See my answer here: http://wordpress.stackexchange.com/a/100486/12324.
The issue you're facing is that permastructs are adding multiple custom post types to the URL, which is confusing WordPress. You'll need to add your rewrite rules using add_rewrite_rule().
1
I would say you need to add the following rewrite rule in your foreach loop:
add_rewrite_rule('^'.$pt_slug.'/category/(.+?)/page/?([0-9]{1,})/?','index.php?post_type='.$post_type.'&category_name=$matches[1]&paged=$matches[2]','top');
1
one way you could do this with an internal WordPress rewrite, which would then set a query var you could check when enqueueing your javascript, and pass that data via localize script.
so first, rewrite rule to intercept requests to gallery/ with something appended, load the page named gallery, and set the query var gallery_id to whatever was in the URL. ...
0
Try changing the Blog pages show at most in settings->reading . This solved the problem I had with pagination which is almost the same.
2
Redirects are GET requests usually, and the browser doesn’t send the POST data for those. That’s not something WordPress can change.
You could create a session, or – better – process the POST data first, then redirect. In your plugin, you could do:
add_action( 'plugins_loaded', 'process_post_data', 0 );
function process_post_data()
{
// Read raw POST ...
-1
I change the pagination param from "paged" to "page" and works! Dont give 404 more =)
0
You would need to create a custom rewrite rule that maps not just the post slug but also the cid value, see this article:
http://www.prodeveloper.org/create-your-own-rewrite-rules-in-wordpress.html
And the relevant Codex documentation:
http://codex.wordpress.org/Rewrite_API
http://codex.wordpress.org/Rewrite_API/add_rewrite_rule
I'm assuming you don't ...
7
Always flush the rewrite rules when you register a new public post type or taxonomy. Otherwise the internal rewrite rules will not take that into account when an URL is mapped to a query.
You can automate that process by hooking into registered_post_type and registered_taxonomy.
Below is the updated code, based on feedback from comments and other people.
...
0
Is your Blog page the one that's set in the back end at Settings > Reading > Posts page? If so, try checking for that in your first function:
/* Add .htm extension to Page URL Links */
add_action('init', 'htm_page_permalink', -1);
function htm_page_permalink() {
global $post;
if( get_option( 'page_for_posts' ) == $post->ID ) {
// ...
Top 50 recent answers are included
