How to check for empty and not a failure

You test for a fail by explicitly testing for false: if (null === $mypostids) { /* it failed */ } NB: three equals signs! you want to check for identical, not just equivalent edit: originally said false, changed to null after looking at get_result() function in source.

Concurrent / simultaneous MySQL connections

IMHO that would depend on the hosting company and what resources you are limited to. Let’s say you pick Amazon’s MySQL RDS. There are seven server models permitted. Each model allows a maximum value for the number of connections. I wrote a post about this last month in the DBA StackExchanage : Should I increase … Read more

Query WordPress database by registered date and role

I’m no SQL expert, but I think it would look something like this: SELECT * FROM mydatabase.wp_users INNER JOIN mydatabase.wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1=1 AND wp_users.user_registered > ‘2014-03-15 00:00:00’ AND wp_users.user_registered < ‘2014-03-16 00:00:00’ AND ( (wp_usermeta.meta_key = ‘wp_capabilities’ AND CAST(wp_usermeta.meta_value AS CHAR) LIKE ‘%\”subscriber\”%’) ) ORDER BY user_registered ASC ;

What is the purpose of storing `siteurl` in database?

Since you mention multiple environments you can manually define the site URL within your wp-config.php file define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/path/to/wordpress’); define(‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/path/to/wordpress’); Keep in mind that it will override what you have set in your options table. As detailed in the documentation: Setting this value in wp-config.php overrides the … Read more

Subscribers to posts

If for “all the conversations a user is in” you mean “all the conversations where a user has commented” you dont need any additional table, just a SQL to get all the posts of conversation CPT where an user commented. Here a function that should do the trick: /** * Get posts (of a given … Read more

How does WordPress store data?

I have looked inside WordPress database. Never do that unless you need to have an external utility to be able to read data from the DB. For wordpress development always use the proper API for what you need, there was a lot of time invested into making the APIs efficient and there is no need … Read more