Answer the question
In order to leave comments, you need to log in
How to properly organize a query into several Wordpress database tables at once?
Good afternoon. A general question regarding the selection and processing of results from various Wordpress database tables (CMS does not really play a fundamental role). It matured from the desire to reproduce and optimize the standard queries of the engine in order to reduce the load on the database.
There is a query to the wp_posts table that stores Wordpress posts:
$posts = $wpdb->get_results("SELECT * FROM wp_posts {условия выборки});
foreach ($posts as $post) :
{...определяются некоторые переменные...}
$thumbmeta = $wpdb->get_var("SELECT meta_value FROM wp_postmeta WHERE post_id = '$thumbid' AND meta_key = '_wp_attachment_metadata'");
{...внутри цикла foreach на основе этих метаданных производятся парсинг и манипуляции с полученными значениями...}
<?php endforeach; ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question