WordPress.org

Ready to get started?Download WordPress

Forums

Is template_redirect() too late for rewrite tags? (1 post)

  1. bobbingwide
    Member
    Posted 1 year ago #

    I'm implementing some functionality to handle remote requests from other sites and have used add_rewrite_tag(), add_permastruct() and add_action( 'template_redirect', 'myfunc' ) to intercept the request.
    Within myfunc(), if get_query_var() returns something then my code serves up the answer. Otherwise things carry on as normal.

    BUT I notice that, between the 'request' filter and 'template_redirect' action, 'the_posts' gets invoked and it accesses the database unnecessarily.

    What should I be doing to prevent these database queries?

Topic Closed

This topic has been closed to new replies.

About this Topic