Uses
Uses | Description |
---|---|
wp-includes/wp-db.php: wpdb::get_results() | Retrieves an entire SQL result set from the database (i.e., many rows). |
wp-includes/wp-db.php: wpdb::prepare() | Prepares a SQL query for safe execution. |
Return count of imported permalinks from WordPress database
(string) (Required)
(string) (Required)
(int)
File: wp-admin/includes/class-wp-importer.php
public function count_imported_posts( $importer_name, $bid ) { global $wpdb; $count = 0; // Get count of permalinks. $meta_key = $importer_name . '_' . $bid . '_permalink'; $sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ); $result = $wpdb->get_results( $sql ); if ( ! empty( $result ) ) { $count = intval( $result[0]->cnt ); } // Unset to save memory. unset( $results ); return $count; }
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_importer/count_imported_posts