List down the steps and commands used to generate a database query in WordPress.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our W3Make Forum to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
There are two ways to run a database query command in WordPress:
Using the wpdb class
include_once(‘wp-db.php’);
$results = $wpdb->query(‘SELECT * FROM posts’);
Using the WP-CLI
wp db query ‘SELECT * FROM posts’