Selecting records

As usual, there is a set of built-in functions for selecting records from the existing tables. The following list contains a few of the data-selecting functions:

get_posts This retrieves the posts as an array from the wp_posts table based on the passed arguments. Also, we can use the WP_Query class with the necessary arguments to get the post list from the OOP method. Accepts an array type parameter with all post details.
get_option This retrieves the option value of the given key from the wp_options table. Accepts a key parameter.
get_users This retrieves a list of users as an array from the wp_user table. Accepts an array type parameter with all post details.

 

Most of the database operations on exiting tables ...

Get WordPress Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.