I have made custom fields using advanced custom field plugin. It has a field name school which includes choices such as arts,education,engineering.
Now my problem is how can i query only those post who field is arts using wpdb. sincerely i don't know wpdb works.
.
Any help will be appreciated :)
0
votes
2 Answers
1
votes
Try using WP_Query over a direct mysql query. https://codex.wordpress.org/Class_Reference/WP_Query
In your WP_Query arguments include the 'meta_key' and 'meta_value' parameters.
$args = array(
'meta_key' => 'school',
'meta_value' => 'arts'
);
0
votes
It's a Wordpress Global Database Access Variable, if you want to executes database related opration than you must use $wpdb
more info : https://codex.wordpress.org/Class_Reference/wpdb