How do I get data from a table in WordPress?

To display posts by category in WordPress, you can use various methods depending on your needs and comfort with coding.

<?php
global $wpdb;
$results = $wpdb->get_results("SELECT *  FROM  wp_terms  WHERE name = 'Subscribe'");
foreach ($results as $row) {
    echo $row->name;
}
?>

administrator

Leave a Reply

Your email address will not be published. Required fields are marked *