Check current URL is 404 in pre_option_stylesheet filter hook

Question

I am trying to check the current url is 404 or not in the pre_option_stylesheet filter 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 curl(), wp_remote_post(), @get_headers($url) but none of these worked for me.

0
DevD 1 month 0 Answers 6 views 0

Leave an answer