• Resolved Cibulka

    (@cibulka)


    Hello again!

    Is it possible to get current post type from (pretty early) wp_loaded hook? Get_current_screen() or global variable $typenow are apparently not ready by that time.

    The only thing I was able to google out was getting the post type by $_GET method which doesn’t really work in my case (as I don’t see the post_type in my URL).

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    No. While WP is loaded, it has yet to do anything with the request. To determine post_type, hook something like ‘request’ or ‘pre_get_posts’.

    Thread Starter Cibulka

    (@cibulka)

    That is pretty much what I was thinking. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get current post_type from wp_loaded hook’ is closed to new replies.