Often with WP, it really helps to actually locate where and how a hook is called before using it.
If you search the code base for edit_form_after_editor
, you’ll locate:
/**
* Fires after the content editor.
*
* @since 3.5.0
*
* @param WP_Post $post Post object.
*/
do_action( 'edit_form_after_editor', $post );
As you can see, $post
is actually passed as an argument here. To access and use it without any chance of error, pass it to your function:
function myprefix_edit_form_after_editor($post) {
var_dump($post);
To weed out non-posts, just go something like:
function myprefix_edit_form_after_editor($post) {
if ($post->post_type != 'post') return;