How to always rewrite author archive page URL even if the author does not have a post

We managed this by hijacking the default author template and setting up our own. Set up a new url rewrite for team members: add_action(‘init’, function () { global $wp_rewrite; $wp_rewrite->author_base=”team”; $wp_rewrite->author_structure=”https://wordpress.stackexchange.com/” . $wp_rewrite->author_base. ‘/%author%’; }); In the template we then use: $uid = get_query_var(‘author’); to get the user’s id. From there you can build out … Read more

how to get archive urls with same origin for custom types and terms?

So, a first solution can be using add_rewrite_rules(). A first raw logic should be something like: 1- get term slugs you need, save in a var, say $terms_string; $terms_string should be a list of pipe-separeted slugs, suitable for regexp, like ‘type1|type2’ etc.. containing ONLY valid (allowed) values. Say use get_terms() to get all the slugs.. … Read more

How to change URL Custom Page?

You’re using the reserved public query variable name as your custom one. It can e.g. affect the canonical redirect by setting page_id and name for a different page. Change it to something else to avoid possible name collision, like kenan_video_slug: add_rewrite_rule( ‘^watch/([^/]*)$’, ‘index.php?pagename=watch&kenan_video_slug=$matches[1]’, ‘top’ ); Note that your rewrite will override the content pagination for … Read more

Why am I getting a 404 on anything past page 1 of my query?

So, it turns out my hunch was correct and the solution is to add some rewrite rules. Here’s what I added: function owr_blog_rewrite( $rules ) { return [ ‘notes/topic/([^/]+)/?$’ => ‘topic=$matches[1]’, ‘notes/topic/([^/]+)/page/([0-9]+)/?$’ => ‘topic=$matches[1]&paged=$matches[2]’, ] + $rules; } add_filter( ‘rewrite_rules_array’, ‘owr_blog_rewrite’ ); Everything works as expected now

Is it possible to remove feeds from rewrites?

Why are you removing rewrite rules? These should not noticeably impact performance, unless there were thousands of entries. Yes, you can remove them, but you will break any functionality associated with those urls, and you won’t improve your site’s speed at all. If you’re concerned about site speed, check out YSlow and Google Page Speed … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)