lundi 29 janvier 2018

Why does !is_404() not behave as expected?

In Wordpress you can use the core function is_404() to check if the current page is a 404 error page. This is a boolean function, meaning it will return TRUE if it is, and FALSE if it isn't.

However, when I place inside an IF function in my header file, and query as so, which I believe is asking IF is_404() returns FALSE...

if(!is_front_page() || !is_404()) {
    // Include something
}

When I view a 404 error page, the line is included where it shouldn't be.

I can perform a check on the value of is_404() using var_dump(), which returns as TRUE.

Why is my //include something line being parsed?

Aucun commentaire:

Enregistrer un commentaire