Analog category_and (WP) in sql query

Thanks Milo for the answer! This block of code selects posts that have two categories at the same time. ( ( SELECT COUNT(1) FROM wp_term_relationships WHERE term_taxonomy_id IN (35,33) AND object_id = wp_posts.ID ) = 2 ) Where 35,33 are categories IDs and 2 – number of categories.

How to create a database table?

There are several things going on here Firstly, your dbDelta call never receives a CREATE SQL statement. $sql is only defined if the if statement is true, and if your developer environment is setup correctly then running this code should generate PHP Warnings. You’re actually running dbDelta(”); dbDelta already does this check though. It’s not … Read more

Using $wpdb to insert data into a table

If i understand well, users will update their datas in front-office, and you need to save datas in your custom table. I think you must check on wp_ajax process which will allow you to post datas in JS to a WP_ajax handler. This handler will be a PHP function, (can be written in your theme’s … Read more

How do I find out from my database what version of WordPress I need?

Actually, you have a db_version in a “_options” table, also there are information about installed plugins and themes. With information about dates when website was disrupted you can get back to approximate versions of plugins. With these assumptions you can recover the most appropriate version of WP where that version of a plugin works correctly … Read more

blank page after update my theme

A blank page (‘white screen of death’) is usually caused by a fatal error in the PHP code. Since you said that you updated your theme (although it is not clear whether you personally updated the code, or if the theme was updated by the theme developer), then the problem is most likely in the … Read more