function validate_file_to_edit( $file, $allowed_files = '' ) {}

Make sure that the file that was requested to edit, is allowed to be edited
Function will die if if you are not allowed to edit the file


  • string $file: file the users is attempting to edit
  • array $allowed_files: Array of allowed files to edit, $file must match an entry exactly

Source code

function validate_file_to_edit( $file, $allowed_files = '' ) {

	$code = validate_file( $file, $allowed_files );

	if (!$code )

		return $file;

	switch ( $code ) {

		case 1 :

			wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));

		//case 2 :

		//	wp_die( __('Sorry, can’t call files with their real path.' ));

		case 3 :

			wp_die( __('Sorry, that file cannot be edited.' ));




No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: