how can i register a special url (slug) in WordPress so that i don’t get an 404?

At the moment i set the status_header to 200 but i think that is not the right way? right?

if (is_404())
{
     $curUrl_arr = explode("/", preg_replace("/^//", '', $_SERVER['REQUEST_URI']));
     if($curUrl_arr[0] == 'XXXXXX')
     {
            status_header(200);
            // some code
     }
}

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Read more here: Worpress register special URL


Solution:

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: