wp_ajax_edit_theme_plugin_file() WordPress Function

This function is used to edit a plugin file via the WordPress AJAX interface. It is used to edit plugin files when the user is not logged in. The function first checks the user's permissions, then verifies the nonce and finally checks if the user is allowed to edit the file.

wp_ajax_edit_theme_plugin_file() #

Ajax handler for editing a theme or plugin file.


Description

Top ↑

See also


Top ↑

Source

File: wp-admin/includes/ajax-actions.php

function wp_ajax_edit_theme_plugin_file() {
	$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) ); // Validation of args is done in wp_edit_theme_plugin_file().

	if ( is_wp_error( $r ) ) {
		wp_send_json_error(
			array_merge(
				array(
					'code'    => $r->get_error_code(),
					'message' => $r->get_error_message(),
				),
				(array) $r->get_error_data()
			)
		);
	} else {
		wp_send_json_success(
			array(
				'message' => __( 'File edited successfully.' ),
			)
		);
	}
}


Top ↑

Changelog

Changelog
VersionDescription
4.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More