I’m searching for a function that tells me if an URL returns a 404
HTTP error or “Page not found” inside WordPress.
Could be something like is_404($url)
, but this function works without parameters.
Thanks in advance.
I’m searching for a function that tells me if an URL returns a 404
HTTP error or “Page not found” inside WordPress.
Could be something like is_404($url)
, but this function works without parameters.
Thanks in advance.
You must be logged in to post a comment.
It’s possibile achieve that using curl.
EDIT
Add this to your functions.php:
and then make a call to
wpcf_is_404();
in your template files or in your functions.php to test if the given url returns true ( 404 ) or false ( all other responses )Hope it helps!