author | ymh <ymh.work@gmail.com> |
Wed, 21 Sep 2022 18:19:35 +0200 | |
changeset 18 | be944660c56a |
parent 16 | a86126ab1dd4 |
child 19 | 3d72ae0968f4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Generic Request (POST/GET) Handler |
|
4 |
* |
|
5 |
* Intended for form submission handling in themes and plugins. |
|
6 |
* |
|
7 |
* @package WordPress |
|
8 |
* @subpackage Administration |
|
9 |
*/ |
|
10 |
||
11 |
/** We are located in WordPress Administration Screens */ |
|
5 | 12 |
if ( ! defined( 'WP_ADMIN' ) ) { |
13 |
define( 'WP_ADMIN', true ); |
|
14 |
} |
|
0 | 15 |
|
9 | 16 |
if ( defined( 'ABSPATH' ) ) { |
16 | 17 |
require_once ABSPATH . 'wp-load.php'; |
9 | 18 |
} else { |
16 | 19 |
require_once dirname( __DIR__ ) . '/wp-load.php'; |
9 | 20 |
} |
0 | 21 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
/** Allow for cross-domain requests (from the front end). */ |
0 | 23 |
send_origin_headers(); |
24 |
||
16 | 25 |
require_once ABSPATH . 'wp-admin/includes/admin.php'; |
0 | 26 |
|
27 |
nocache_headers(); |
|
28 |
||
29 |
/** This action is documented in wp-admin/admin.php */ |
|
30 |
do_action( 'admin_init' ); |
|
31 |
||
5 | 32 |
$action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action']; |
0 | 33 |
|
9 | 34 |
if ( ! is_user_logged_in() ) { |
5 | 35 |
if ( empty( $action ) ) { |
36 |
/** |
|
9 | 37 |
* Fires on a non-authenticated admin post request where no action is supplied. |
5 | 38 |
* |
39 |
* @since 2.6.0 |
|
40 |
*/ |
|
41 |
do_action( 'admin_post_nopriv' ); |
|
42 |
} else { |
|
43 |
/** |
|
44 |
* Fires on a non-authenticated admin post request for the given action. |
|
45 |
* |
|
46 |
* The dynamic portion of the hook name, `$action`, refers to the given |
|
47 |
* request action. |
|
48 |
* |
|
49 |
* @since 2.6.0 |
|
50 |
*/ |
|
51 |
do_action( "admin_post_nopriv_{$action}" ); |
|
52 |
} |
|
53 |
} else { |
|
54 |
if ( empty( $action ) ) { |
|
55 |
/** |
|
9 | 56 |
* Fires on an authenticated admin post request where no action is supplied. |
5 | 57 |
* |
58 |
* @since 2.6.0 |
|
59 |
*/ |
|
60 |
do_action( 'admin_post' ); |
|
61 |
} else { |
|
62 |
/** |
|
63 |
* Fires on an authenticated admin post request for the given action. |
|
64 |
* |
|
65 |
* The dynamic portion of the hook name, `$action`, refers to the given |
|
66 |
* request action. |
|
67 |
* |
|
68 |
* @since 2.6.0 |
|
69 |
*/ |
|
70 |
do_action( "admin_post_{$action}" ); |
|
71 |
} |
|
72 |
} |