wp/wp-admin/post.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     9  */
     9  */
    10 
    10 
    11 /** WordPress Administration Bootstrap */
    11 /** WordPress Administration Bootstrap */
    12 require_once( dirname( __FILE__ ) . '/admin.php' );
    12 require_once( dirname( __FILE__ ) . '/admin.php' );
    13 
    13 
    14 $parent_file = 'edit.php';
    14 $parent_file  = 'edit.php';
    15 $submenu_file = 'edit.php';
    15 $submenu_file = 'edit.php';
    16 
    16 
    17 wp_reset_vars( array( 'action' ) );
    17 wp_reset_vars( array( 'action' ) );
    18 
    18 
    19 if ( isset( $_GET['post'] ) )
    19 if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
    20  	$post_id = $post_ID = (int) $_GET['post'];
    20 	wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
    21 elseif ( isset( $_POST['post_ID'] ) )
    21 } elseif ( isset( $_GET['post'] ) ) {
    22  	$post_id = $post_ID = (int) $_POST['post_ID'];
    22 	$post_id = $post_ID = (int) $_GET['post'];
    23 else
    23 } elseif ( isset( $_POST['post_ID'] ) ) {
    24  	$post_id = $post_ID = 0;
    24 	$post_id = $post_ID = (int) $_POST['post_ID'];
       
    25 } else {
       
    26 	$post_id = $post_ID = 0;
       
    27 }
    25 
    28 
    26 /**
    29 /**
    27  * @global string  $post_type
    30  * @global string  $post_type
    28  * @global object  $post_type_object
    31  * @global object  $post_type_object
    29  * @global WP_Post $post
    32  * @global WP_Post $post
    30  */
    33  */
    31 global $post_type, $post_type_object, $post;
    34 global $post_type, $post_type_object, $post;
    32 
    35 
    33 if ( $post_id )
    36 if ( $post_id ) {
    34 	$post = get_post( $post_id );
    37 	$post = get_post( $post_id );
       
    38 }
    35 
    39 
    36 if ( $post ) {
    40 if ( $post ) {
    37 	$post_type = $post->post_type;
    41 	$post_type        = $post->post_type;
    38 	$post_type_object = get_post_type_object( $post_type );
    42 	$post_type_object = get_post_type_object( $post_type );
    39 }
    43 }
    40 
    44 
    41 if ( isset( $_POST['deletepost'] ) )
    45 if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
       
    46 	wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
       
    47 }
       
    48 
       
    49 if ( isset( $_POST['deletepost'] ) ) {
    42 	$action = 'delete';
    50 	$action = 'delete';
    43 elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
    51 } elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' == $_POST['wp-preview'] ) {
    44 	$action = 'preview';
    52 	$action = 'preview';
       
    53 }
    45 
    54 
    46 $sendback = wp_get_referer();
    55 $sendback = wp_get_referer();
    47 if ( ! $sendback ||
    56 if ( ! $sendback ||
    48      strpos( $sendback, 'post.php' ) !== false ||
    57 	 strpos( $sendback, 'post.php' ) !== false ||
    49      strpos( $sendback, 'post-new.php' ) !== false ) {
    58 	 strpos( $sendback, 'post-new.php' ) !== false ) {
    50 	if ( 'attachment' == $post_type ) {
    59 	if ( 'attachment' == $post_type ) {
    51 		$sendback = admin_url( 'upload.php' );
    60 		$sendback = admin_url( 'upload.php' );
    52 	} else {
    61 	} else {
    53 		$sendback = admin_url( 'edit.php' );
    62 		$sendback = admin_url( 'edit.php' );
    54 		if ( ! empty( $post_type ) ) {
    63 		if ( ! empty( $post_type ) ) {
    55 			$sendback = add_query_arg( 'post_type', $post_type, $sendback );
    64 			$sendback = add_query_arg( 'post_type', $post_type, $sendback );
    56 		}
    65 		}
    57 	}
    66 	}
    58 } else {
    67 } else {
    59 	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
    68 	$sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), $sendback );
    60 }
    69 }
    61 
    70 
    62 switch($action) {
    71 switch ( $action ) {
    63 case 'post-quickdraft-save':
    72 	case 'post-quickdraft-save':
    64 	// Check nonce and capabilities
    73 		// Check nonce and capabilities
    65 	$nonce = $_REQUEST['_wpnonce'];
    74 		$nonce     = $_REQUEST['_wpnonce'];
    66 	$error_msg = false;
    75 		$error_msg = false;
    67 
    76 
    68 	// For output of the quickdraft dashboard widget
    77 		// For output of the quickdraft dashboard widget
    69 	require_once ABSPATH . 'wp-admin/includes/dashboard.php';
    78 		require_once ABSPATH . 'wp-admin/includes/dashboard.php';
    70 
    79 
    71 	if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
    80 		if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
    72 		$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
    81 			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
    73 
    82 		}
    74 	if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
    83 
       
    84 		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
       
    85 			exit;
       
    86 		}
       
    87 
       
    88 		if ( $error_msg ) {
       
    89 			return wp_dashboard_quick_press( $error_msg );
       
    90 		}
       
    91 
       
    92 		$post = get_post( $_REQUEST['post_ID'] );
       
    93 		check_admin_referer( 'add-' . $post->post_type );
       
    94 
       
    95 		$_POST['comment_status'] = get_default_comment_status( $post->post_type );
       
    96 		$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
       
    97 
       
    98 		edit_post();
       
    99 		wp_dashboard_quick_press();
    75 		exit;
   100 		exit;
    76 	}
   101 
    77 
   102 	case 'postajaxpost':
    78 	if ( $error_msg )
   103 	case 'post':
    79 		return wp_dashboard_quick_press( $error_msg );
   104 		check_admin_referer( 'add-' . $post_type );
    80 
   105 		$post_id = 'postajaxpost' == $action ? edit_post() : write_post();
    81 	$post = get_post( $_REQUEST['post_ID'] );
   106 		redirect_post( $post_id );
    82 	check_admin_referer( 'add-' . $post->post_type );
   107 		exit();
    83 
   108 
    84 	$_POST['comment_status'] = get_default_comment_status( $post->post_type );
   109 	case 'edit':
    85 	$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
   110 		$editing = true;
    86 
   111 
    87 	edit_post();
   112 		if ( empty( $post_id ) ) {
    88 	wp_dashboard_quick_press();
   113 			wp_redirect( admin_url( 'post.php' ) );
    89 	exit;
   114 			exit();
    90 
   115 		}
    91 case 'postajaxpost':
   116 
    92 case 'post':
   117 		if ( ! $post ) {
    93 	check_admin_referer( 'add-' . $post_type );
   118 			wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
    94 	$post_id = 'postajaxpost' == $action ? edit_post() : write_post();
   119 		}
    95 	redirect_post( $post_id );
   120 
    96 	exit();
   121 		if ( ! $post_type_object ) {
    97 
   122 			wp_die( __( 'Invalid post type.' ) );
    98 case 'edit':
   123 		}
    99 	$editing = true;
   124 
   100 
   125 		if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
   101 	if ( empty( $post_id ) ) {
   126 			wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
   102 		wp_redirect( admin_url('post.php') );
   127 		}
   103 		exit();
   128 
   104 	}
   129 		if ( ! current_user_can( 'edit_post', $post_id ) ) {
   105 
   130 			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
   106 	if ( ! $post )
   131 		}
   107 		wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
   132 
   108 
   133 		if ( 'trash' == $post->post_status ) {
   109 	if ( ! $post_type_object )
   134 			wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
   110 		wp_die( __( 'Invalid post type.' ) );
   135 		}
   111 
   136 
   112 	if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
   137 		if ( ! empty( $_GET['get-post-lock'] ) ) {
   113 		wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
   138 			check_admin_referer( 'lock-post_' . $post_id );
   114 	}
   139 			wp_set_post_lock( $post_id );
   115 
   140 			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
   116 	if ( ! current_user_can( 'edit_post', $post_id ) )
   141 			exit();
   117 		wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
   142 		}
   118 
   143 
   119 	if ( 'trash' == $post->post_status )
   144 		$post_type = $post->post_type;
   120 		wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
   145 		if ( 'post' == $post_type ) {
   121 
   146 			$parent_file   = 'edit.php';
   122 	if ( ! empty( $_GET['get-post-lock'] ) ) {
   147 			$submenu_file  = 'edit.php';
   123 		check_admin_referer( 'lock-post_' . $post_id );
   148 			$post_new_file = 'post-new.php';
   124 		wp_set_post_lock( $post_id );
   149 		} elseif ( 'attachment' == $post_type ) {
   125 		wp_redirect( get_edit_post_link( $post_id, 'url' ) );
   150 			$parent_file   = 'upload.php';
   126 		exit();
   151 			$submenu_file  = 'upload.php';
   127 	}
   152 			$post_new_file = 'media-new.php';
   128 
   153 		} else {
   129 	$post_type = $post->post_type;
   154 			if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
   130 	if ( 'post' == $post_type ) {
   155 				$parent_file = $post_type_object->show_in_menu;
   131 		$parent_file = "edit.php";
   156 			} else {
   132 		$submenu_file = "edit.php";
   157 				$parent_file = "edit.php?post_type=$post_type";
   133 		$post_new_file = "post-new.php";
   158 			}
   134 	} elseif ( 'attachment' == $post_type ) {
   159 			$submenu_file  = "edit.php?post_type=$post_type";
   135 		$parent_file = 'upload.php';
   160 			$post_new_file = "post-new.php?post_type=$post_type";
   136 		$submenu_file = 'upload.php';
   161 		}
   137 		$post_new_file = 'media-new.php';
   162 
   138 	} else {
   163 		$title = $post_type_object->labels->edit_item;
   139 		if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
   164 
   140 			$parent_file = $post_type_object->show_in_menu;
   165 		/**
   141 		else
   166 		 * Allows replacement of the editor.
   142 			$parent_file = "edit.php?post_type=$post_type";
   167 		 *
   143 		$submenu_file = "edit.php?post_type=$post_type";
   168 		 * @since 4.9.0
   144 		$post_new_file = "post-new.php?post_type=$post_type";
   169 		 *
   145 	}
   170 		 * @param boolean      Whether to replace the editor. Default false.
   146 
   171 		 * @param object $post Post object.
   147 	/**
   172 		 */
   148 	 * Allows replacement of the editor.
   173 		if ( apply_filters( 'replace_editor', false, $post ) === true ) {
   149 	 *
   174 			break;
   150 	 * @since 4.9.0
   175 		}
   151 	 *
   176 
   152 	 * @param boolean      Whether to replace the editor. Default false.
   177 		if ( use_block_editor_for_post( $post ) ) {
   153 	 * @param object $post Post object.
   178 			include( ABSPATH . 'wp-admin/edit-form-blocks.php' );
   154 	 */
   179 			break;
   155 	if ( apply_filters( 'replace_editor', false, $post ) === true ) {
   180 		}
       
   181 
       
   182 		if ( ! wp_check_post_lock( $post->ID ) ) {
       
   183 			$active_post_lock = wp_set_post_lock( $post->ID );
       
   184 
       
   185 			if ( 'attachment' !== $post_type ) {
       
   186 				wp_enqueue_script( 'autosave' );
       
   187 			}
       
   188 		}
       
   189 
       
   190 		$post = get_post( $post_id, OBJECT, 'edit' );
       
   191 
       
   192 		if ( post_type_supports( $post_type, 'comments' ) ) {
       
   193 			wp_enqueue_script( 'admin-comments' );
       
   194 			enqueue_comment_hotkeys_js();
       
   195 		}
       
   196 
       
   197 		include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
       
   198 
   156 		break;
   199 		break;
   157 	}
   200 
   158 
   201 	case 'editattachment':
   159 	if ( ! wp_check_post_lock( $post->ID ) ) {
   202 		check_admin_referer( 'update-post_' . $post_id );
   160 		$active_post_lock = wp_set_post_lock( $post->ID );
   203 
   161 
   204 		// Don't let these be changed
   162 		if ( 'attachment' !== $post_type )
   205 		unset( $_POST['guid'] );
   163 			wp_enqueue_script('autosave');
   206 		$_POST['post_type'] = 'attachment';
   164 	}
   207 
   165 
   208 		// Update the thumbnail filename
   166 	$title = $post_type_object->labels->edit_item;
   209 		$newmeta          = wp_get_attachment_metadata( $post_id, true );
   167 	$post = get_post($post_id, OBJECT, 'edit');
   210 		$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
   168 
   211 
   169 	if ( post_type_supports($post_type, 'comments') ) {
   212 		wp_update_attachment_metadata( $post_id, $newmeta );
   170 		wp_enqueue_script('admin-comments');
   213 
   171 		enqueue_comment_hotkeys_js();
   214 		// Intentional fall-through to trigger the edit_post() call.
   172 	}
   215 	case 'editpost':
   173 
   216 		check_admin_referer( 'update-post_' . $post_id );
   174 	include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
   217 
   175 
   218 		$post_id = edit_post();
   176 	break;
   219 
   177 
   220 		// Session cookie flag that the post was saved
   178 case 'editattachment':
   221 		if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
   179 	check_admin_referer('update-post_' . $post_id);
   222 			setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
   180 
   223 		}
   181 	// Don't let these be changed
   224 
   182 	unset($_POST['guid']);
   225 		redirect_post( $post_id ); // Send user on their way while we keep working
   183 	$_POST['post_type'] = 'attachment';
   226 
   184 
   227 		exit();
   185 	// Update the thumbnail filename
   228 
   186 	$newmeta = wp_get_attachment_metadata( $post_id, true );
   229 	case 'trash':
   187 	$newmeta['thumb'] = $_POST['thumb'];
   230 		check_admin_referer( 'trash-post_' . $post_id );
   188 
   231 
   189 	wp_update_attachment_metadata( $post_id, $newmeta );
   232 		if ( ! $post ) {
   190 
   233 			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
   191 case 'editpost':
   234 		}
   192 	check_admin_referer('update-post_' . $post_id);
   235 
   193 
   236 		if ( ! $post_type_object ) {
   194 	$post_id = edit_post();
   237 			wp_die( __( 'Invalid post type.' ) );
   195 
   238 		}
   196 	// Session cookie flag that the post was saved
   239 
   197 	if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
   240 		if ( ! current_user_can( 'delete_post', $post_id ) ) {
   198 		setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
   241 			wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
   199 	}
   242 		}
   200 
   243 
   201 	redirect_post($post_id); // Send user on their way while we keep working
   244 		if ( $user_id = wp_check_post_lock( $post_id ) ) {
   202 
   245 			$user = get_userdata( $user_id );
   203 	exit();
   246 			wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
   204 
   247 		}
   205 case 'trash':
   248 
   206 	check_admin_referer('trash-post_' . $post_id);
   249 		if ( ! wp_trash_post( $post_id ) ) {
   207 
   250 			wp_die( __( 'Error in moving to Trash.' ) );
   208 	if ( ! $post )
   251 		}
   209 		wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
   252 
   210 
   253 		wp_redirect(
   211 	if ( ! $post_type_object )
   254 			add_query_arg(
   212 		wp_die( __( 'Invalid post type.' ) );
   255 				array(
   213 
   256 					'trashed' => 1,
   214 	if ( ! current_user_can( 'delete_post', $post_id ) )
   257 					'ids'     => $post_id,
   215 		wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
   258 				),
   216 
   259 				$sendback
   217 	if ( $user_id = wp_check_post_lock( $post_id ) ) {
   260 			)
   218 		$user = get_userdata( $user_id );
   261 		);
   219 		wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
   262 		exit();
   220 	}
   263 
   221 
   264 	case 'untrash':
   222 	if ( ! wp_trash_post( $post_id ) )
   265 		check_admin_referer( 'untrash-post_' . $post_id );
   223 		wp_die( __( 'Error in moving to Trash.' ) );
   266 
   224 
   267 		if ( ! $post ) {
   225 	wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
   268 			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
   226 	exit();
   269 		}
   227 
   270 
   228 case 'untrash':
   271 		if ( ! $post_type_object ) {
   229 	check_admin_referer('untrash-post_' . $post_id);
   272 			wp_die( __( 'Invalid post type.' ) );
   230 
   273 		}
   231 	if ( ! $post )
   274 
   232 		wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
   275 		if ( ! current_user_can( 'delete_post', $post_id ) ) {
   233 
   276 			wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
   234 	if ( ! $post_type_object )
   277 		}
   235 		wp_die( __( 'Invalid post type.' ) );
   278 
   236 
   279 		if ( ! wp_untrash_post( $post_id ) ) {
   237 	if ( ! current_user_can( 'delete_post', $post_id ) )
   280 			wp_die( __( 'Error in restoring from Trash.' ) );
   238 		wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
   281 		}
   239 
   282 
   240 	if ( ! wp_untrash_post( $post_id ) )
   283 		wp_redirect( add_query_arg( 'untrashed', 1, $sendback ) );
   241 		wp_die( __( 'Error in restoring from Trash.' ) );
   284 		exit();
   242 
   285 
   243 	wp_redirect( add_query_arg('untrashed', 1, $sendback) );
   286 	case 'delete':
   244 	exit();
   287 		check_admin_referer( 'delete-post_' . $post_id );
   245 
   288 
   246 case 'delete':
   289 		if ( ! $post ) {
   247 	check_admin_referer('delete-post_' . $post_id);
   290 			wp_die( __( 'This item has already been deleted.' ) );
   248 
   291 		}
   249 	if ( ! $post )
   292 
   250 		wp_die( __( 'This item has already been deleted.' ) );
   293 		if ( ! $post_type_object ) {
   251 
   294 			wp_die( __( 'Invalid post type.' ) );
   252 	if ( ! $post_type_object )
   295 		}
   253 		wp_die( __( 'Invalid post type.' ) );
   296 
   254 
   297 		if ( ! current_user_can( 'delete_post', $post_id ) ) {
   255 	if ( ! current_user_can( 'delete_post', $post_id ) )
   298 			wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
   256 		wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
   299 		}
   257 
   300 
   258 	if ( $post->post_type == 'attachment' ) {
   301 		if ( $post->post_type == 'attachment' ) {
   259 		$force = ( ! MEDIA_TRASH );
   302 			$force = ( ! MEDIA_TRASH );
   260 		if ( ! wp_delete_attachment( $post_id, $force ) )
   303 			if ( ! wp_delete_attachment( $post_id, $force ) ) {
   261 			wp_die( __( 'Error in deleting.' ) );
   304 				wp_die( __( 'Error in deleting.' ) );
   262 	} else {
   305 			}
   263 		if ( ! wp_delete_post( $post_id, true ) )
   306 		} else {
   264 			wp_die( __( 'Error in deleting.' ) );
   307 			if ( ! wp_delete_post( $post_id, true ) ) {
   265 	}
   308 				wp_die( __( 'Error in deleting.' ) );
   266 
   309 			}
   267 	wp_redirect( add_query_arg('deleted', 1, $sendback) );
   310 		}
   268 	exit();
   311 
   269 
   312 		wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
   270 case 'preview':
   313 		exit();
   271 	check_admin_referer( 'update-post_' . $post_id );
   314 
   272 
   315 	case 'preview':
   273 	$url = post_preview();
   316 		check_admin_referer( 'update-post_' . $post_id );
   274 
   317 
   275 	wp_redirect($url);
   318 		$url = post_preview();
   276 	exit();
   319 
   277 
   320 		wp_redirect( $url );
   278 default:
   321 		exit();
   279 	/**
   322 
   280 	 * Fires for a given custom post action request.
   323 	case 'toggle-custom-fields':
   281 	 *
   324 		check_admin_referer( 'toggle-custom-fields' );
   282 	 * The dynamic portion of the hook name, `$action`, refers to the custom post action.
   325 
   283 	 *
   326 		$current_user_id = get_current_user_id();
   284 	 * @since 4.6.0
   327 		if ( $current_user_id ) {
   285 	 *
   328 			$enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
   286 	 * @param int $post_id Post ID sent with the request.
   329 			update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
   287 	 */
   330 		}
   288 	do_action( "post_action_{$action}", $post_id );
   331 
   289 
   332 		wp_safe_redirect( wp_get_referer() );
   290 	wp_redirect( admin_url('edit.php') );
   333 		exit();
   291 	exit();
   334 
       
   335 	default:
       
   336 		/**
       
   337 		 * Fires for a given custom post action request.
       
   338 		 *
       
   339 		 * The dynamic portion of the hook name, `$action`, refers to the custom post action.
       
   340 		 *
       
   341 		 * @since 4.6.0
       
   342 		 *
       
   343 		 * @param int $post_id Post ID sent with the request.
       
   344 		 */
       
   345 		do_action( "post_action_{$action}", $post_id );
       
   346 
       
   347 		wp_redirect( admin_url( 'edit.php' ) );
       
   348 		exit();
   292 } // end switch
   349 } // end switch
   293 include( ABSPATH . 'wp-admin/admin-footer.php' );
   350 include( ABSPATH . 'wp-admin/admin-footer.php' );