• Resolved Anonymous User 14379775

    (@anonymized-14379775)


    Hi!
    Not a big problem but I see that native wp conditional tag
    is_404()
    do not work with this plugin (return false instead of true).

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Peter Raschendorfer

    (@petersplugins)

    You are right. That’s because the Plugin loads the defined 404 page, which exists and therefore is_404() correctly is false. In my tests I’ve tried to set is_404() to true after loading the page but that causes problems with some themes that use is_404() to show their default 404 error although a page was loaded successfully.

    If you need to add functionality in case of a 404 error you can use the 404page_after_404 hook. Is that OK for you or do you think there has to be an option to switch is_404() to true if needed?

    Peter

    Thread Starter Anonymous User 14379775

    (@anonymized-14379775)

    I do not know if that’s a problem for other people, but I’ve tried to enqueue some additional CSS only on 404 page specifically and discovered that is_404() was not working.
    But I simply used another conditional tag for this purpose, like
    is_page(‘slug’) and achieved the same result as was planned.

    • This reply was modified 9 years, 6 months ago by Anonymous User 14379775.
    Plugin Contributor Peter Raschendorfer

    (@petersplugins)

    You do not need this at all. The plugin adds a class error404 to the body tag. Use this for styling.

    Thread Starter Anonymous User 14379775

    (@anonymized-14379775)

    Not quite so.
    I add additional CSS File (using wp_enqueue_style) so that it appears only on 404 page and not on the entire site.

    Plugin Contributor Peter Raschendorfer

    (@petersplugins)

    OK, I think the additional CSS should not be worth mentioning for the page size, but if you’d like to only load it on the 404 page I’m glad you solved it.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘is_404() do not work’ is closed to new replies.