Check current URL is 404 in pre_option_stylesheet action hook
I am trying to check the current url is
404 or not in the
pre_option_stylesheet action hook. As this is the early hook called by wordpress, due to which wordpress default function like
is_404 not works. It generates a notice saying:
Notice: is_404 was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in D:xamphtdocswordpresswp-includesfunctions.php on line 5229
I also tried to check 404 by using
@get_headers($url) but none of these worked for me.