post_edit_form_tagaction-hookWP 3.0.0

Allows you to add HTML attributes to the <form> tag of the post publishing form in the admin area.

By default, the opening form tag looks like this:

<form name="post" action="post.php" method="post" id="post">

The default attributes cannot be changed, but this hook lets you add custom attributes.

Usage

add_action( 'post_edit_form_tag', 'wp_kama_post_edit_form_tag_action' );

/**
 * Function for `post_edit_form_tag` action-hook.
 * 
 * @param WP_Post $post Post object.
 *
 * @return void
 */
function wp_kama_post_edit_form_tag_action( $post ){

	// action...
}
$post(WP_Post)
The post object. See get_post() for the object structure.

Examples

#1 Add a custom data attribute

add_action( 'post_edit_form_tag', 'callback__post_edit_form_tag' );
function callback__post_edit_form_tag( $post ) {
	echo 'data-custom="some data"';
}

The opening form tag will look like this:

<form name="post" action="post.php" method="post" id="post" data-custom="some data">

Changelog

Since 3.0.0 Introduced.

Where the hook is called

In file: /wp-admin/edit-form-advanced.php
post_edit_form_tag
wp-admin/edit-form-advanced.php 482
do_action( 'post_edit_form_tag', $post );

Where the hook is used in WordPress

Usage not found.