• Resolved sissi

    (@ebiebzh0)


    Hello,
    I am (also) using the template_redirect action to check some incoming urls, if they have a certain pattern, I either redirect them (301) or set the header to 410. In both cases, I would like that the entry is not logged in the 404 table. I tried the filter “redirection_log_404” (__return_false) but that had no effect. I suspect, that the action might be the issue and that your logging happens already before my action-function is called. I also tried to change the action to send_headers, but that had no effect either.
    Maybe you have an example on where you would put your filter or can point me in the right direction.
    Thank you,
    Sissi

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Godley

    (@johnny5)

    I don’t have an example, but you can try setting your filter earlier, maybe on init

    Thread Starter sissi

    (@ebiebzh0)

    On init is too early, WP does not know yet if is_404() is true or false. Any other ideas?

    Plugin Author John Godley

    (@johnny5)

    Sure. but it doesn’t need to know that when you register the filter.

    Thread Starter sissi

    (@ebiebzh0)

    But I need to know in my logic if it is a 404 or not to do my “magic” …

    Plugin Author John Godley

    (@johnny5)

    Yep, and you do that inside the filter when it is called. But the filter needs to be registered before Redirection calls it.

    Thread Starter sissi

    (@ebiebzh0)

    Actually I need to set the filter according to my “magic” … it seems that the action wp does work.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘do not log certain 404 pages’ is closed to new replies.