How to set up Author archives with sub category URL

As I mentioned in my comment, you can use add_rewrite_endpoint to accomplish this. First, add the endpoint: function wpa_author_endpoints(){ add_rewrite_endpoint( ‘liked-posts’, EP_AUTHORS ); } add_action( ‘init’, ‘wpa_author_endpoints’ ); After flushing rewrite rules (visit your Settings > Permalinks page in admin), author URLs can now be appended with /liked-posts/. Next, add a filter to author_template to … Read more

Use custom template on certain URLs

Thanks to @Milo on the comments, I’m gonna post my answer: Firstly I added this rule: add_rewrite_rule( “en/artist/([^/]+)/?”, ‘index.php?pagename=post_type=artist&artist=$matches[1]&gal_template=en’, “top”); Then this filter: add_filter( ‘query_vars’, ‘gal_query_vars’ ); function gal_query_vars( $query_vars ) { $query_vars[] = ‘gal_template’; return $query_vars; } Finally, I filtered the single template: add_filter( ‘single_template’, ‘get_custom_post_type_template’ ); function get_custom_post_type_template($single_template) { global $post; if ($post->post_type … Read more

Redirect traffic to plugin

You can use the init hook to check the $_REQUEST or $_GET super-global variable for your token value and then redirect to pages that are present via WP Core: home_url wp_login_url If you pass additional parameters to these URLs, such as token_valid=true you can use that along with conditional tags like is_front to conditionally display … Read more

I need a custom permalink for my website

I’m not sure if I should assume that you were issuing your examples inside of the init hook, but if not that is the reason they weren’t working for you. So inside functions.php function sd_rewrite_rules() { add_rewrite_tag(‘%domain_name%’, ‘([^&]+)’); add_rewrite_rule(‘^/([^/]*)/?’,’index.php?domain_name=$matches[1]’,’top’); } add_action(‘init’, ‘sd_rewrite_rules’, 10, 0); Then if you wanted to retrieve the query variable to do … Read more