Edit File by line
/home/barbar84/public_h.../wp-admin
File: admin-ajax.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Ajax Process Execution
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*
[6] Fix | Delete
* @link https://codex.wordpress.org/AJAX_in_Plugins
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Executing Ajax process.
[11] Fix | Delete
*
[12] Fix | Delete
* @since 2.1.0
[13] Fix | Delete
*/
[14] Fix | Delete
define( 'DOING_AJAX', true );
[15] Fix | Delete
if ( ! defined( 'WP_ADMIN' ) ) {
[16] Fix | Delete
define( 'WP_ADMIN', true );
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
/** Load WordPress Bootstrap */
[20] Fix | Delete
require_once dirname( __DIR__ ) . '/wp-load.php';
[21] Fix | Delete
[22] Fix | Delete
/** Allow for cross-domain requests (from the front end). */
[23] Fix | Delete
send_origin_headers();
[24] Fix | Delete
[25] Fix | Delete
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
[26] Fix | Delete
header( 'X-Robots-Tag: noindex' );
[27] Fix | Delete
[28] Fix | Delete
// Require an action parameter.
[29] Fix | Delete
if ( empty( $_REQUEST['action'] ) ) {
[30] Fix | Delete
wp_die( '0', 400 );
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
/** Load WordPress Administration APIs */
[34] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/admin.php';
[35] Fix | Delete
[36] Fix | Delete
/** Load Ajax Handlers for WordPress Core */
[37] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/ajax-actions.php';
[38] Fix | Delete
[39] Fix | Delete
send_nosniff_header();
[40] Fix | Delete
nocache_headers();
[41] Fix | Delete
[42] Fix | Delete
/** This action is documented in wp-admin/admin.php */
[43] Fix | Delete
do_action( 'admin_init' );
[44] Fix | Delete
[45] Fix | Delete
$core_actions_get = array(
[46] Fix | Delete
'fetch-list',
[47] Fix | Delete
'ajax-tag-search',
[48] Fix | Delete
'wp-compression-test',
[49] Fix | Delete
'imgedit-preview',
[50] Fix | Delete
'oembed-cache',
[51] Fix | Delete
'autocomplete-user',
[52] Fix | Delete
'dashboard-widgets',
[53] Fix | Delete
'logged-in',
[54] Fix | Delete
'rest-nonce',
[55] Fix | Delete
);
[56] Fix | Delete
[57] Fix | Delete
$core_actions_post = array(
[58] Fix | Delete
'oembed-cache',
[59] Fix | Delete
'image-editor',
[60] Fix | Delete
'delete-comment',
[61] Fix | Delete
'delete-tag',
[62] Fix | Delete
'delete-link',
[63] Fix | Delete
'delete-meta',
[64] Fix | Delete
'delete-post',
[65] Fix | Delete
'trash-post',
[66] Fix | Delete
'untrash-post',
[67] Fix | Delete
'delete-page',
[68] Fix | Delete
'dim-comment',
[69] Fix | Delete
'add-link-category',
[70] Fix | Delete
'add-tag',
[71] Fix | Delete
'get-tagcloud',
[72] Fix | Delete
'get-comments',
[73] Fix | Delete
'replyto-comment',
[74] Fix | Delete
'edit-comment',
[75] Fix | Delete
'add-menu-item',
[76] Fix | Delete
'add-meta',
[77] Fix | Delete
'add-user',
[78] Fix | Delete
'closed-postboxes',
[79] Fix | Delete
'hidden-columns',
[80] Fix | Delete
'update-welcome-panel',
[81] Fix | Delete
'menu-get-metabox',
[82] Fix | Delete
'wp-link-ajax',
[83] Fix | Delete
'menu-locations-save',
[84] Fix | Delete
'menu-quick-search',
[85] Fix | Delete
'meta-box-order',
[86] Fix | Delete
'get-permalink',
[87] Fix | Delete
'sample-permalink',
[88] Fix | Delete
'inline-save',
[89] Fix | Delete
'inline-save-tax',
[90] Fix | Delete
'find_posts',
[91] Fix | Delete
'widgets-order',
[92] Fix | Delete
'save-widget',
[93] Fix | Delete
'delete-inactive-widgets',
[94] Fix | Delete
'set-post-thumbnail',
[95] Fix | Delete
'date_format',
[96] Fix | Delete
'time_format',
[97] Fix | Delete
'wp-remove-post-lock',
[98] Fix | Delete
'dismiss-wp-pointer',
[99] Fix | Delete
'upload-attachment',
[100] Fix | Delete
'get-attachment',
[101] Fix | Delete
'query-attachments',
[102] Fix | Delete
'save-attachment',
[103] Fix | Delete
'save-attachment-compat',
[104] Fix | Delete
'send-link-to-editor',
[105] Fix | Delete
'send-attachment-to-editor',
[106] Fix | Delete
'save-attachment-order',
[107] Fix | Delete
'media-create-image-subsizes',
[108] Fix | Delete
'heartbeat',
[109] Fix | Delete
'get-revision-diffs',
[110] Fix | Delete
'save-user-color-scheme',
[111] Fix | Delete
'update-widget',
[112] Fix | Delete
'query-themes',
[113] Fix | Delete
'parse-embed',
[114] Fix | Delete
'set-attachment-thumbnail',
[115] Fix | Delete
'parse-media-shortcode',
[116] Fix | Delete
'destroy-sessions',
[117] Fix | Delete
'install-plugin',
[118] Fix | Delete
'update-plugin',
[119] Fix | Delete
'crop-image',
[120] Fix | Delete
'generate-password',
[121] Fix | Delete
'save-wporg-username',
[122] Fix | Delete
'delete-plugin',
[123] Fix | Delete
'search-plugins',
[124] Fix | Delete
'search-install-plugins',
[125] Fix | Delete
'activate-plugin',
[126] Fix | Delete
'update-theme',
[127] Fix | Delete
'delete-theme',
[128] Fix | Delete
'install-theme',
[129] Fix | Delete
'get-post-thumbnail-html',
[130] Fix | Delete
'get-community-events',
[131] Fix | Delete
'edit-theme-plugin-file',
[132] Fix | Delete
'wp-privacy-export-personal-data',
[133] Fix | Delete
'wp-privacy-erase-personal-data',
[134] Fix | Delete
'health-check-site-status-result',
[135] Fix | Delete
'health-check-dotorg-communication',
[136] Fix | Delete
'health-check-is-in-debug-mode',
[137] Fix | Delete
'health-check-background-updates',
[138] Fix | Delete
'health-check-loopback-requests',
[139] Fix | Delete
'health-check-get-sizes',
[140] Fix | Delete
'toggle-auto-updates',
[141] Fix | Delete
'send-password-reset',
[142] Fix | Delete
);
[143] Fix | Delete
[144] Fix | Delete
// Deprecated.
[145] Fix | Delete
$core_actions_post_deprecated = array(
[146] Fix | Delete
'wp-fullscreen-save-post',
[147] Fix | Delete
'press-this-save-post',
[148] Fix | Delete
'press-this-add-category',
[149] Fix | Delete
'health-check-dotorg-communication',
[150] Fix | Delete
'health-check-is-in-debug-mode',
[151] Fix | Delete
'health-check-background-updates',
[152] Fix | Delete
'health-check-loopback-requests',
[153] Fix | Delete
);
[154] Fix | Delete
$core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated );
[155] Fix | Delete
[156] Fix | Delete
// Register core Ajax calls.
[157] Fix | Delete
if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) {
[158] Fix | Delete
add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) {
[162] Fix | Delete
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' );
[166] Fix | Delete
[167] Fix | Delete
add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
[168] Fix | Delete
[169] Fix | Delete
$action = ( isset( $_REQUEST['action'] ) ) ? $_REQUEST['action'] : '';
[170] Fix | Delete
[171] Fix | Delete
if ( is_user_logged_in() ) {
[172] Fix | Delete
// If no action is registered, return a Bad Request response.
[173] Fix | Delete
if ( ! has_action( "wp_ajax_{$action}" ) ) {
[174] Fix | Delete
wp_die( '0', 400 );
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
/**
[178] Fix | Delete
* Fires authenticated Ajax actions for logged-in users.
[179] Fix | Delete
*
[180] Fix | Delete
* The dynamic portion of the hook name, `$action`, refers
[181] Fix | Delete
* to the name of the Ajax action callback being fired.
[182] Fix | Delete
*
[183] Fix | Delete
* @since 2.1.0
[184] Fix | Delete
*/
[185] Fix | Delete
do_action( "wp_ajax_{$action}" );
[186] Fix | Delete
} else {
[187] Fix | Delete
// If no action is registered, return a Bad Request response.
[188] Fix | Delete
if ( ! has_action( "wp_ajax_nopriv_{$action}" ) ) {
[189] Fix | Delete
wp_die( '0', 400 );
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
/**
[193] Fix | Delete
* Fires non-authenticated Ajax actions for logged-out users.
[194] Fix | Delete
*
[195] Fix | Delete
* The dynamic portion of the hook name, `$action`, refers
[196] Fix | Delete
* to the name of the Ajax action callback being fired.
[197] Fix | Delete
*
[198] Fix | Delete
* @since 2.8.0
[199] Fix | Delete
*/
[200] Fix | Delete
do_action( "wp_ajax_nopriv_{$action}" );
[201] Fix | Delete
}
[202] Fix | Delete
// Default status.
[203] Fix | Delete
wp_die( '0' );
[204] Fix | Delete
[205] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function