attachment url rewrite

Actually, you can always just use a query parameter, even if you have the “pretty” permalinks enabled. So instead of /category/sub-category/article.html/attachment/image you can go to /?attachment=image. The only case when this “breaks down” is when you go to /category/sub-category/article.html?attachment=image, because WordPress gets confused: it tries to query for a post and an attachment at the … Read more

Is dynamic URL possible in WordPress

Not completely sure I understand what you mean with that the parameters fall under a page job, but if you mean that different contents are loaded on the same page using javascript / ajax, you could use https://github.com/browserstate/history.js/ to generate the corresponding url for each state. Difficult to say more about how you could implement … Read more

Possible to create a permalink to sort with meta_key?

What about something like that? function wpse139657_orderby(){ if( isset($_GET[‘orderby’]) ){ $order = $_GET[‘order’] or ‘DESC’; set_query_var(‘orderby’, ‘meta_value_num’); set_query_var(‘meta_key’, $_GET[‘orderby’]); set_query_var(‘order’, $order); } } add_filter(‘pre_get_posts’,’wpse139657_orderby’); In this way you can call your urls with a ?orderby=rank suffixed and it should do the trick. You can also have an optional order parameter, should you want to implement … Read more

Search results URL without query string variables

It’s better to share some of your code that already you used. And you mention first line that you have search page ? what exactly you mean by that ? WordPress have default search page did you mention that one ? if you are then try this code function change_search_url_rewrite() { if ( is_search() && … Read more

Author Specific URL’s in WordPress

here you go: add_action(‘init’, ‘wp_new_flush_rewrite_rules’); //Run this action only ONCE if not you are looking at 2 extra db queries on every page load so dont forget to comment it out function wp_new_flush_rewrite_rules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } add_action(‘generate_rewrite_rules’, ‘new_rewrite_rules’); function new_rewrite_rules( $wp_rewrite ) { $post_type=”post”; $new_rules = array( ‘writer/(.+?)/page/?([0-9]{1,})/?$’ => ‘index.php?post_type=”.$post_type.”&meta_key=writer&meta_value=”.$wp_rewrite->preg_index(1).”&paged=’.$wp_rewrite->preg_index(2), ‘writer/(.+?)/?$’ => ‘index.php?post_type=”.$post_type.”&meta_key=writer&meta_value=”.$wp_rewrite->preg_index(1), … Read more