Docs: Explicitly declare some globals for clarity.

This aims to improve developer experience by making it clear that these variables are defined elsewhere.

Props ravipatel, davidbaumwald, hellofromTonya, costdev, SergeyBiryukov.
Fixes #51439.

git-svn-id: https://develop.svn.wordpress.org/trunk@53450 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-05-29 15:33:12 +00:00
parent 4e83085806
commit a53b828af9
5 changed files with 37 additions and 3 deletions
+10
View File
@@ -9,6 +9,11 @@
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
/**
* @global string $typenow The post type of the current screen.
*/
global $typenow;
if ( ! $typenow ) {
wp_die( __( 'Invalid post type.' ) );
}
@@ -87,6 +92,11 @@ if ( $doaction ) {
$post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] );
// Validate the post status exists.
if ( get_post_status_object( $post_status ) ) {
/**
* @global wpdb $wpdb WordPress database abstraction object.
*/
global $wpdb;
$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
}
$doaction = 'delete';