Custom permalinks with NextGEN Gallery
Have you had a look at the rewrite API? Maybe this can solve your problem? If you use the rewrite API, then you probably should turn of NextGen rewrite function.
Have you had a look at the rewrite API? Maybe this can solve your problem? If you use the rewrite API, then you probably should turn of NextGen rewrite function.
Use the field in the admin Settings > Permalinks page to set your permalink structure to /blog/%year%/%monthnum%/%postname%/. To prevent custom post types from inheriting the post permalink structure, set with_front to false in your register_post_type arguments for all custom post types. Version 4.4 also added the register_post_type_args filter to allow modification of post type arguments … Read more
The pattern WordPress uses to recognize pages is (.+?), which will match anything, but is not greedy, so it allows you to put something at the end. The following code works for me in WordPress 3.0.1: it places the extra pattern at the second-to-last place of the list, because the final pattern is so generic … Read more
You can use the %author% tag in the rewrite property in register_post_type(). However, although the rewrite rules are added (after they’re flushed) – WordPress doesn’t replace the tag with its appropriate value when generating the permalink of your post type. For instance you end up with the permalink www.example.com/%author%/gallery-name The following replaces %author% with the … Read more
None of the above worked for me. Found another solution by overwriting the search rewrite rules using the search_rewrite_rules filter. 1 – Add this to the functions.php of your theme: add_filter( ‘search_rewrite_rules’, function($rules) { $new_rules = []; // New search slug here $new_search_slug = ‘zoeken’; foreach ($rules AS $key => $value){ $new_rules[str_replace(‘search’, $new_search_slug, $key)] = … Read more
I’m still struggling with the exact requirements but if I understand correctly I think you can do to accomplish your goals if you use the code I provide you below and then do the following: Create a page for each of your services (which it sounds like you have already done): /service1/, /service2/, etc. Create … Read more
The Simplest way is to add a Query var to the list of query var that WordPress recognizes and check for that newly added query var on template redirect hook ex: add_filter( ‘query_vars’, ‘se67095_add_query_vars’); /** * Add the ‘my_plugin’ query variable so WordPress * won’t remove it. */ function se67095_add_query_vars($vars){ $vars[] = “my_plugin”; return $vars; … Read more
That rewrite rule won’t work at all, flushed or not. There’s two kinds of rewrite rules in WordPress. Those that have their rewrite urls start with index.php and those that don’t. All WordPress internal rewrite rules must start with index.php. It can’t redirect to anyplace else, because it’s already been redirected to the index.php file … Read more
Update Eliminating all of the other solutions, there is at least one remaining: template_redirect: function wpse121308_redirect_homepage() { // Check for blog posts index // NOT site front page, // which would be is_front_page() if ( is_home() ) { wp_redirect( get_category_link( $id ) ); exit(); } } add_action( ‘template_redirect’, ‘wpse121308_redirect_homepage’ ); You will need to pass … Read more
You can use pre_get_posts as suggested but simply check the global $wp object for the request url.. like so: add_action( ‘pre_get_posts’, function ($query ){ global $wp; if ( !is_admin() && $query->is_main_query() ) { if ($wp->request == ‘cats’){ header(‘Content-Type: application/json’); $cats = array(‘Hobbes’, ‘Simba’, ‘Grumpy Cat’); echo json_encode($cats); exit; } } }); (PHP 5.3+ in this … Read more