0

When the add post or edit post screens load, is there an action other than save_post which I can hook on to? I need to make an API request before a user starts adding / editing posts. Basically when the add or edit post screen loads I need my API call to be made. I know that save_post first when those pages are loaded, i'm just wondering if there is an earlier action I can hook on to? I've looked at http://codex.wordpress.org/Plugin_API/Action_Reference and do not see any useful other than save_post

Thanks

1 Answer 1

1

you can use load-{page-hook}. It is called prior to the admin screen loading.

add_action( 'load-post-new.php', 'post_listing_page' );
function post_listing_page() {
    // 'add new' page, you may have to check post type..
}
  • {page-hook} on the 'add new' page of any post type, it is post-new.php
  • {page-hook} on the edit page of any post type, it is post.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.