I am using the post_rewrite_rules filter to rewrite the posts url to make the posts URLS like this post-slug.xyn.com instead of xyn.com/post-slug

First of all i applied the fulsh_funtion() to prepare my posts URLS

Then i applied the “post_rewrite_rules” filter in this way :

add_filter(‘post_rewrite_rules’, array( &$this, ‘filter_post_rewrite_rules’), 10, 1 );

public function filter_post_rewrite_rules( $post_rewrite ) {
            // this doesn't work
            /*$post_rewrite  = array(
                "$" => "index.php?pagename=" . $this->subdomain_post->post_name,
            $post_rewrite = array();
                            // so i tried this but still doesn't work too :()
            $post_rewrite = array();
            $post_rewrite["$this->subdomain_post->post_name.bramjstore.com"] = "index.php?pagename=" . $this->subdomain_post->post_name;

        return $post_rewrite;

Any idea ?

Read more here: problem with post_rewrite_rules filter


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: