0

How can I Fetch posts that are stored in the different table than the default table (wp_posts)?

0

Try below code

global $wpdb;
$result = $wpdb->get_results($wpdb->prepare("SELECT * FROM TABLE_NAME));

Replace TABLE_NAME with your custom table name.

  • Where should I add this code? – Mohammad Kamal Jan 24 '17 at 13:19
  • the name of the table: blogb_posts – Mohammad Kamal Jan 24 '17 at 13:24
  • You can create a short code using this code and add the short code in your page template or in the edit page section. For short code please refer - speckyboy.com/… – Ravi Shinde Jan 24 '17 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.