How to list all categories and their IDs using SQL query?

I finally got the solution. Below SQL Query gets the list of all categories with it’s ID from WordPress table – SELECT wp_term_taxonomy.term_id, wp_terms.name FROM wp_term_relationships LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) LEFT JOIN wp_terms ON (wp_terms.term_id = wp_term_taxonomy.term_taxonomy_id) WHERE wp_term_taxonomy.taxonomy = ‘category’ GROUP BY wp_term_taxonomy.term_id order by wp_terms.name Hope this could help others.

Sending posts from Python to WordPress

Use the REST API at /wp-json, there are endpoints for retrieving posts that you can POST to. You will need a plugin installed to provide authentication, I recommend OAuth2. Then, you can use an OAuth2 and a REST API library in python. You do not need to use a WordPress specific library.

Delete post revisions only for a single post

If you need an SQL query, then this option should be suitable function src_flush_revisions () { global $wpdb; $post_id = 5//exp post id if ( isset( $timeLimit ) ) { $revision_ids = $wpdb->get_col( $wpdb->prepare( “SELECT `ID` FROM $wpdb->posts WHERE `post_type` = ‘revision’ AND `post_parent` = %d”, $post_id ) ); foreach ( $revision_ids as $revision_id ) … Read more

Some weird users in database

Might be this is due to the Spam. Diable use registration under the General -> Settings if you don’t need registration on the front-end or use the captcha or other spam protection plugins. Regarding the backend -> Have you checked the wp_usermeta table if any role assigned to those users or not? Check user roles … Read more