Edit File by line
/home/barbar84/public_h.../wp-admin
File: edit.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Edit Posts Administration Screen.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/** WordPress Administration Bootstrap */
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
[10] Fix | Delete
if ( ! $typenow ) {
[11] Fix | Delete
wp_die( __( 'Invalid post type.' ) );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
[15] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
if ( 'attachment' === $typenow ) {
[19] Fix | Delete
if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
[20] Fix | Delete
exit;
[21] Fix | Delete
}
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* @global string $post_type
[26] Fix | Delete
* @global WP_Post_Type $post_type_object
[27] Fix | Delete
*/
[28] Fix | Delete
global $post_type, $post_type_object;
[29] Fix | Delete
[30] Fix | Delete
$post_type = $typenow;
[31] Fix | Delete
$post_type_object = get_post_type_object( $post_type );
[32] Fix | Delete
[33] Fix | Delete
if ( ! $post_type_object ) {
[34] Fix | Delete
wp_die( __( 'Invalid post type.' ) );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
[38] Fix | Delete
wp_die(
[39] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[40] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to edit posts in this post type.' ) . '</p>',
[41] Fix | Delete
403
[42] Fix | Delete
);
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
[46] Fix | Delete
$pagenum = $wp_list_table->get_pagenum();
[47] Fix | Delete
[48] Fix | Delete
// Back-compat for viewing comments of an entry.
[49] Fix | Delete
foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
[50] Fix | Delete
if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
[51] Fix | Delete
wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
[52] Fix | Delete
exit;
[53] Fix | Delete
}
[54] Fix | Delete
}
[55] Fix | Delete
unset( $_redirect );
[56] Fix | Delete
[57] Fix | Delete
if ( 'post' !== $post_type ) {
[58] Fix | Delete
$parent_file = "edit.php?post_type=$post_type";
[59] Fix | Delete
$submenu_file = "edit.php?post_type=$post_type";
[60] Fix | Delete
$post_new_file = "post-new.php?post_type=$post_type";
[61] Fix | Delete
} else {
[62] Fix | Delete
$parent_file = 'edit.php';
[63] Fix | Delete
$submenu_file = 'edit.php';
[64] Fix | Delete
$post_new_file = 'post-new.php';
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
$doaction = $wp_list_table->current_action();
[68] Fix | Delete
[69] Fix | Delete
if ( $doaction ) {
[70] Fix | Delete
check_admin_referer( 'bulk-posts' );
[71] Fix | Delete
[72] Fix | Delete
$sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'locked', 'ids' ), wp_get_referer() );
[73] Fix | Delete
if ( ! $sendback ) {
[74] Fix | Delete
$sendback = admin_url( $parent_file );
[75] Fix | Delete
}
[76] Fix | Delete
$sendback = add_query_arg( 'paged', $pagenum, $sendback );
[77] Fix | Delete
if ( strpos( $sendback, 'post.php' ) !== false ) {
[78] Fix | Delete
$sendback = admin_url( $post_new_file );
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
if ( 'delete_all' === $doaction ) {
[82] Fix | Delete
// Prepare for deletion of all posts with a specified post status (i.e. Empty Trash).
[83] Fix | Delete
$post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] );
[84] Fix | Delete
// Validate the post status exists.
[85] Fix | Delete
if ( get_post_status_object( $post_status ) ) {
[86] Fix | Delete
$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
[87] Fix | Delete
}
[88] Fix | Delete
$doaction = 'delete';
[89] Fix | Delete
} elseif ( isset( $_REQUEST['media'] ) ) {
[90] Fix | Delete
$post_ids = $_REQUEST['media'];
[91] Fix | Delete
} elseif ( isset( $_REQUEST['ids'] ) ) {
[92] Fix | Delete
$post_ids = explode( ',', $_REQUEST['ids'] );
[93] Fix | Delete
} elseif ( ! empty( $_REQUEST['post'] ) ) {
[94] Fix | Delete
$post_ids = array_map( 'intval', $_REQUEST['post'] );
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
if ( ! isset( $post_ids ) ) {
[98] Fix | Delete
wp_redirect( $sendback );
[99] Fix | Delete
exit;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
switch ( $doaction ) {
[103] Fix | Delete
case 'trash':
[104] Fix | Delete
$trashed = 0;
[105] Fix | Delete
$locked = 0;
[106] Fix | Delete
[107] Fix | Delete
foreach ( (array) $post_ids as $post_id ) {
[108] Fix | Delete
if ( ! current_user_can( 'delete_post', $post_id ) ) {
[109] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ( wp_check_post_lock( $post_id ) ) {
[113] Fix | Delete
$locked++;
[114] Fix | Delete
continue;
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
if ( ! wp_trash_post( $post_id ) ) {
[118] Fix | Delete
wp_die( __( 'Error in moving the item to Trash.' ) );
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
$trashed++;
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
$sendback = add_query_arg(
[125] Fix | Delete
array(
[126] Fix | Delete
'trashed' => $trashed,
[127] Fix | Delete
'ids' => implode( ',', $post_ids ),
[128] Fix | Delete
'locked' => $locked,
[129] Fix | Delete
),
[130] Fix | Delete
$sendback
[131] Fix | Delete
);
[132] Fix | Delete
break;
[133] Fix | Delete
case 'untrash':
[134] Fix | Delete
$untrashed = 0;
[135] Fix | Delete
[136] Fix | Delete
if ( isset( $_GET['doaction'] ) && ( 'undo' === $_GET['doaction'] ) ) {
[137] Fix | Delete
add_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 );
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
foreach ( (array) $post_ids as $post_id ) {
[141] Fix | Delete
if ( ! current_user_can( 'delete_post', $post_id ) ) {
[142] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
if ( ! wp_untrash_post( $post_id ) ) {
[146] Fix | Delete
wp_die( __( 'Error in restoring the item from Trash.' ) );
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
$untrashed++;
[150] Fix | Delete
}
[151] Fix | Delete
$sendback = add_query_arg( 'untrashed', $untrashed, $sendback );
[152] Fix | Delete
[153] Fix | Delete
remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 );
[154] Fix | Delete
[155] Fix | Delete
break;
[156] Fix | Delete
case 'delete':
[157] Fix | Delete
$deleted = 0;
[158] Fix | Delete
foreach ( (array) $post_ids as $post_id ) {
[159] Fix | Delete
$post_del = get_post( $post_id );
[160] Fix | Delete
[161] Fix | Delete
if ( ! current_user_can( 'delete_post', $post_id ) ) {
[162] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
if ( 'attachment' === $post_del->post_type ) {
[166] Fix | Delete
if ( ! wp_delete_attachment( $post_id ) ) {
[167] Fix | Delete
wp_die( __( 'Error in deleting the attachment.' ) );
[168] Fix | Delete
}
[169] Fix | Delete
} else {
[170] Fix | Delete
if ( ! wp_delete_post( $post_id ) ) {
[171] Fix | Delete
wp_die( __( 'Error in deleting the item.' ) );
[172] Fix | Delete
}
[173] Fix | Delete
}
[174] Fix | Delete
$deleted++;
[175] Fix | Delete
}
[176] Fix | Delete
$sendback = add_query_arg( 'deleted', $deleted, $sendback );
[177] Fix | Delete
break;
[178] Fix | Delete
case 'edit':
[179] Fix | Delete
if ( isset( $_REQUEST['bulk_edit'] ) ) {
[180] Fix | Delete
$done = bulk_edit_posts( $_REQUEST );
[181] Fix | Delete
[182] Fix | Delete
if ( is_array( $done ) ) {
[183] Fix | Delete
$done['updated'] = count( $done['updated'] );
[184] Fix | Delete
$done['skipped'] = count( $done['skipped'] );
[185] Fix | Delete
$done['locked'] = count( $done['locked'] );
[186] Fix | Delete
$sendback = add_query_arg( $done, $sendback );
[187] Fix | Delete
}
[188] Fix | Delete
}
[189] Fix | Delete
break;
[190] Fix | Delete
default:
[191] Fix | Delete
$screen = get_current_screen()->id;
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Fires when a custom bulk action should be handled.
[195] Fix | Delete
*
[196] Fix | Delete
* The redirect link should be modified with success or failure feedback
[197] Fix | Delete
* from the action to be used to display feedback to the user.
[198] Fix | Delete
*
[199] Fix | Delete
* The dynamic portion of the hook name, `$screen`, refers to the current screen ID.
[200] Fix | Delete
*
[201] Fix | Delete
* @since 4.7.0
[202] Fix | Delete
*
[203] Fix | Delete
* @param string $sendback The redirect URL.
[204] Fix | Delete
* @param string $doaction The action being taken.
[205] Fix | Delete
* @param array $items The items to take the action on. Accepts an array of IDs of posts,
[206] Fix | Delete
* comments, terms, links, plugins, attachments, or users.
[207] Fix | Delete
*/
[208] Fix | Delete
$sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[209] Fix | Delete
break;
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
$sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback );
[213] Fix | Delete
[214] Fix | Delete
wp_redirect( $sendback );
[215] Fix | Delete
exit;
[216] Fix | Delete
} elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
[217] Fix | Delete
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
[218] Fix | Delete
exit;
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
$wp_list_table->prepare_items();
[222] Fix | Delete
[223] Fix | Delete
wp_enqueue_script( 'inline-edit-post' );
[224] Fix | Delete
wp_enqueue_script( 'heartbeat' );
[225] Fix | Delete
[226] Fix | Delete
if ( 'wp_block' === $post_type ) {
[227] Fix | Delete
wp_enqueue_script( 'wp-list-reusable-blocks' );
[228] Fix | Delete
wp_enqueue_style( 'wp-list-reusable-blocks' );
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
$title = $post_type_object->labels->name;
[232] Fix | Delete
[233] Fix | Delete
if ( 'post' === $post_type ) {
[234] Fix | Delete
get_current_screen()->add_help_tab(
[235] Fix | Delete
array(
[236] Fix | Delete
'id' => 'overview',
[237] Fix | Delete
'title' => __( 'Overview' ),
[238] Fix | Delete
'content' =>
[239] Fix | Delete
'<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>',
[240] Fix | Delete
)
[241] Fix | Delete
);
[242] Fix | Delete
get_current_screen()->add_help_tab(
[243] Fix | Delete
array(
[244] Fix | Delete
'id' => 'screen-content',
[245] Fix | Delete
'title' => __( 'Screen Content' ),
[246] Fix | Delete
'content' =>
[247] Fix | Delete
'<p>' . __( 'You can customize the display of this screen&#8217;s contents in a number of ways:' ) . '</p>' .
[248] Fix | Delete
'<ul>' .
[249] Fix | Delete
'<li>' . __( 'You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.' ) . '</li>' .
[250] Fix | Delete
'<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' .
[251] Fix | Delete
'<li>' . __( 'You can view posts in a simple title list or with an excerpt using the Screen Options tab.' ) . '</li>' .
[252] Fix | Delete
'<li>' . __( 'You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.' ) . '</li>' .
[253] Fix | Delete
'</ul>',
[254] Fix | Delete
)
[255] Fix | Delete
);
[256] Fix | Delete
get_current_screen()->add_help_tab(
[257] Fix | Delete
array(
[258] Fix | Delete
'id' => 'action-links',
[259] Fix | Delete
'title' => __( 'Available Actions' ),
[260] Fix | Delete
'content' =>
[261] Fix | Delete
'<p>' . __( 'Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:' ) . '</p>' .
[262] Fix | Delete
'<ul>' .
[263] Fix | Delete
'<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.' ) . '</li>' .
[264] Fix | Delete
'<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.' ) . '</li>' .
[265] Fix | Delete
'<li>' . __( '<strong>Trash</strong> removes your post from this list and places it in the Trash, from which you can permanently delete it.' ) . '</li>' .
[266] Fix | Delete
'<li>' . __( '<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.' ) . '</li>' .
[267] Fix | Delete
'</ul>',
[268] Fix | Delete
)
[269] Fix | Delete
);
[270] Fix | Delete
get_current_screen()->add_help_tab(
[271] Fix | Delete
array(
[272] Fix | Delete
'id' => 'bulk-actions',
[273] Fix | Delete
'title' => __( 'Bulk actions' ),
[274] Fix | Delete
'content' =>
[275] Fix | Delete
'<p>' . __( 'You can also edit or move multiple posts to the Trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk actions menu and click Apply.' ) . '</p>' .
[276] Fix | Delete
'<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.' ) . '</p>',
[277] Fix | Delete
)
[278] Fix | Delete
);
[279] Fix | Delete
[280] Fix | Delete
get_current_screen()->set_help_sidebar(
[281] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[282] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/posts-screen/">Documentation on Managing Posts</a>' ) . '</p>' .
[283] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[284] Fix | Delete
);
[285] Fix | Delete
[286] Fix | Delete
} elseif ( 'page' === $post_type ) {
[287] Fix | Delete
get_current_screen()->add_help_tab(
[288] Fix | Delete
array(
[289] Fix | Delete
'id' => 'overview',
[290] Fix | Delete
'title' => __( 'Overview' ),
[291] Fix | Delete
'content' =>
[292] Fix | Delete
'<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>',
[293] Fix | Delete
)
[294] Fix | Delete
);
[295] Fix | Delete
get_current_screen()->add_help_tab(
[296] Fix | Delete
array(
[297] Fix | Delete
'id' => 'managing-pages',
[298] Fix | Delete
'title' => __( 'Managing Pages' ),
[299] Fix | Delete
'content' =>
[300] Fix | Delete
'<p>' . __( 'Managing pages is very similar to managing posts, and the screens can be customized in the same way.' ) . '</p>' .
[301] Fix | Delete
'<p>' . __( 'You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk actions menu to edit the metadata for multiple pages at once.' ) . '</p>',
[302] Fix | Delete
)
[303] Fix | Delete
);
[304] Fix | Delete
[305] Fix | Delete
get_current_screen()->set_help_sidebar(
[306] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[307] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Managing Pages</a>' ) . '</p>' .
[308] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[309] Fix | Delete
);
[310] Fix | Delete
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
get_current_screen()->set_screen_reader_content(
[314] Fix | Delete
array(
[315] Fix | Delete
'heading_views' => $post_type_object->labels->filter_items_list,
[316] Fix | Delete
'heading_pagination' => $post_type_object->labels->items_list_navigation,
[317] Fix | Delete
'heading_list' => $post_type_object->labels->items_list,
[318] Fix | Delete
)
[319] Fix | Delete
);
[320] Fix | Delete
[321] Fix | Delete
add_screen_option(
[322] Fix | Delete
'per_page',
[323] Fix | Delete
array(
[324] Fix | Delete
'default' => 20,
[325] Fix | Delete
'option' => 'edit_' . $post_type . '_per_page',
[326] Fix | Delete
)
[327] Fix | Delete
);
[328] Fix | Delete
[329] Fix | Delete
$bulk_counts = array(
[330] Fix | Delete
'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0,
[331] Fix | Delete
'locked' => isset( $_REQUEST['locked'] ) ? absint( $_REQUEST['locked'] ) : 0,
[332] Fix | Delete
'deleted' => isset( $_REQUEST['deleted'] ) ? absint( $_REQUEST['deleted'] ) : 0,
[333] Fix | Delete
'trashed' => isset( $_REQUEST['trashed'] ) ? absint( $_REQUEST['trashed'] ) : 0,
[334] Fix | Delete
'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0,
[335] Fix | Delete
);
[336] Fix | Delete
[337] Fix | Delete
$bulk_messages = array();
[338] Fix | Delete
$bulk_messages['post'] = array(
[339] Fix | Delete
/* translators: %s: Number of posts. */
[340] Fix | Delete
'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
[341] Fix | Delete
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
[342] Fix | Delete
/* translators: %s: Number of posts. */
[343] Fix | Delete
_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
[344] Fix | Delete
/* translators: %s: Number of posts. */
[345] Fix | Delete
'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
[346] Fix | Delete
/* translators: %s: Number of posts. */
[347] Fix | Delete
'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
[348] Fix | Delete
/* translators: %s: Number of posts. */
[349] Fix | Delete
'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
[350] Fix | Delete
);
[351] Fix | Delete
$bulk_messages['page'] = array(
[352] Fix | Delete
/* translators: %s: Number of pages. */
[353] Fix | Delete
'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
[354] Fix | Delete
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
[355] Fix | Delete
/* translators: %s: Number of pages. */
[356] Fix | Delete
_n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
[357] Fix | Delete
/* translators: %s: Number of pages. */
[358] Fix | Delete
'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
[359] Fix | Delete
/* translators: %s: Number of pages. */
[360] Fix | Delete
'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
[361] Fix | Delete
/* translators: %s: Number of pages. */
[362] Fix | Delete
'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
[363] Fix | Delete
);
[364] Fix | Delete
$bulk_messages['wp_block'] = array(
[365] Fix | Delete
/* translators: %s: Number of blocks. */
[366] Fix | Delete
'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ),
[367] Fix | Delete
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) :
[368] Fix | Delete
/* translators: %s: Number of blocks. */
[369] Fix | Delete
_n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ),
[370] Fix | Delete
/* translators: %s: Number of blocks. */
[371] Fix | Delete
'deleted' => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ),
[372] Fix | Delete
/* translators: %s: Number of blocks. */
[373] Fix | Delete
'trashed' => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ),
[374] Fix | Delete
/* translators: %s: Number of blocks. */
[375] Fix | Delete
'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ),
[376] Fix | Delete
);
[377] Fix | Delete
[378] Fix | Delete
/**
[379] Fix | Delete
* Filters the bulk action updated messages.
[380] Fix | Delete
*
[381] Fix | Delete
* By default, custom post types use the messages for the 'post' post type.
[382] Fix | Delete
*
[383] Fix | Delete
* @since 3.7.0
[384] Fix | Delete
*
[385] Fix | Delete
* @param array[] $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are
[386] Fix | Delete
* keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'.
[387] Fix | Delete
* @param int[] $bulk_counts Array of item counts for each message, used to build internationalized strings.
[388] Fix | Delete
*/
[389] Fix | Delete
$bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
[390] Fix | Delete
$bulk_counts = array_filter( $bulk_counts );
[391] Fix | Delete
[392] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[393] Fix | Delete
?>
[394] Fix | Delete
<div class="wrap">
[395] Fix | Delete
<h1 class="wp-heading-inline">
[396] Fix | Delete
<?php
[397] Fix | Delete
echo esc_html( $post_type_object->labels->name );
[398] Fix | Delete
?>
[399] Fix | Delete
</h1>
[400] Fix | Delete
[401] Fix | Delete
<?php
[402] Fix | Delete
if ( current_user_can( $post_type_object->cap->create_posts ) ) {
[403] Fix | Delete
echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
[407] Fix | Delete
echo '<span class="subtitle">';
[408] Fix | Delete
printf(
[409] Fix | Delete
/* translators: %s: Search query. */
[410] Fix | Delete
__( 'Search results for: %s' ),
[411] Fix | Delete
'<strong>' . get_search_query() . '</strong>'
[412] Fix | Delete
);
[413] Fix | Delete
echo '</span>';
[414] Fix | Delete
}
[415] Fix | Delete
?>
[416] Fix | Delete
[417] Fix | Delete
<hr class="wp-header-end">
[418] Fix | Delete
[419] Fix | Delete
<?php
[420] Fix | Delete
// If we have a bulk message to issue:
[421] Fix | Delete
$messages = array();
[422] Fix | Delete
foreach ( $bulk_counts as $message => $count ) {
[423] Fix | Delete
if ( isset( $bulk_messages[ $post_type ][ $message ] ) ) {
[424] Fix | Delete
$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
[425] Fix | Delete
} elseif ( isset( $bulk_messages['post'][ $message ] ) ) {
[426] Fix | Delete
$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
if ( 'trashed' === $message && isset( $_REQUEST['ids'] ) ) {
[430] Fix | Delete
$ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
[431] Fix | Delete
$messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", 'bulk-posts' ) ) . '">' . __( 'Undo' ) . '</a>';
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
if ( 'untrashed' === $message && isset( $_REQUEST['ids'] ) ) {
[435] Fix | Delete
$ids = explode( ',', $_REQUEST['ids'] );
[436] Fix | Delete
[437] Fix | Delete
if ( 1 === count( $ids ) && current_user_can( 'edit_post', $ids[0] ) ) {
[438] Fix | Delete
$messages[] = sprintf(
[439] Fix | Delete
'<a href="%1$s">%2$s</a>',
[440] Fix | Delete
esc_url( get_edit_post_link( $ids[0] ) ),
[441] Fix | Delete
esc_html( get_post_type_object( get_post_type( $ids[0] ) )->labels->edit_item )
[442] Fix | Delete
);
[443] Fix | Delete
}
[444] Fix | Delete
}
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
if ( $messages ) {
[448] Fix | Delete
echo '<div id="message" class="updated notice is-dismissible"><p>' . implode( ' ', $messages ) . '</p></div>';
[449] Fix | Delete
}
[450] Fix | Delete
unset( $messages );
[451] Fix | Delete
[452] Fix | Delete
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] );
[453] Fix | Delete
?>
[454] Fix | Delete
[455] Fix | Delete
<?php $wp_list_table->views(); ?>
[456] Fix | Delete
[457] Fix | Delete
<form id="posts-filter" method="get">
[458] Fix | Delete
[459] Fix | Delete
<?php $wp_list_table->search_box( $post_type_object->labels->search_items, 'post' ); ?>
[460] Fix | Delete
[461] Fix | Delete
<input type="hidden" name="post_status" class="post_status_page" value="<?php echo ! empty( $_REQUEST['post_status'] ) ? esc_attr( $_REQUEST['post_status'] ) : 'all'; ?>" />
[462] Fix | Delete
<input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
[463] Fix | Delete
[464] Fix | Delete
<?php if ( ! empty( $_REQUEST['author'] ) ) { ?>
[465] Fix | Delete
<input type="hidden" name="author" value="<?php echo esc_attr( $_REQUEST['author'] ); ?>" />
[466] Fix | Delete
<?php } ?>
[467] Fix | Delete
[468] Fix | Delete
<?php if ( ! empty( $_REQUEST['show_sticky'] ) ) { ?>
[469] Fix | Delete
<input type="hidden" name="show_sticky" value="1" />
[470] Fix | Delete
<?php } ?>
[471] Fix | Delete
[472] Fix | Delete
<?php $wp_list_table->display(); ?>
[473] Fix | Delete
[474] Fix | Delete
</form>
[475] Fix | Delete
[476] Fix | Delete
<?php
[477] Fix | Delete
if ( $wp_list_table->has_items() ) {
[478] Fix | Delete
$wp_list_table->inline_edit();
[479] Fix | Delete
}
[480] Fix | Delete
?>
[481] Fix | Delete
[482] Fix | Delete
<div id="ajax-response"></div>
[483] Fix | Delete
<div class="clear" /></div>
[484] Fix | Delete
</div>
[485] Fix | Delete
[486] Fix | Delete
<?php
[487] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[488] Fix | Delete
[489] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function