Action hook 'admin_post'

in WP Core File wp-admin/admin-post.php at line 67

View Source

admin_post

Action Hook
Description
Fires on an authenticated admin post request where no action is supplied.

Hook Information

File Location wp-admin/admin-post.php View on GitHub
Hook Type Action
Line Number 67

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into admin_post
add_action('admin_post', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-admin/admin-post.php:67 - How this hook is used in WordPress core
<?php
  62  		/**
  63  		 * Fires on an authenticated admin post request where no action is supplied.
  64  		 *
  65  		 * @since 2.6.0
  66  		 */
  67  		do_action( 'admin_post' );
  68  	} else {
  69  		// If no action is registered, return a Bad Request response.
  70  		if ( ! has_action( "admin_post_{$action}" ) ) {
  71  			wp_die( '', 400 );
  72  		}

PHP Documentation

<?php
/**
		 * Fires on an authenticated admin post request where no action is supplied.
		 *
		 * @since 2.6.0
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-admin/admin-post.php
Related Hooks

Related hooks will be displayed here in future updates.