SQL Query to Get Posts Using Category Name

select p.id, p.post_title from wp_posts p inner join wp_term_relationships tr on tr.object_id = p.ID inner join wp_terms t on tr.term_taxonomy_id = t.term_id inner join wp_term_taxonomy tt on tt.term_taxonomy_id = t.term_id where post_status =’publish’ and tt.taxonomy = ‘category’ and t.name = ‘Renewed’

Read more SQL Query to Get Posts Using Category Name

[How to] Display Number of Posts in WordPress

Using WordPress core function wp_count_posts, you can easily display total number of posts. Here is a simple example on how to use this function: <?php $count_posts = wp_count_posts(); $published_posts = $count_posts->publish; echo ‘We published ‘ . $published_posts . ‘ posts until now, and it’s still growing..’; ?> This displays a text output like this; We […]

Read more [How to] Display Number of Posts in WordPress

MySQL Query to List WordPress Posts Using Meta Query

To get a list of WordPress Posts using meta query in MySQL, you can use the following SQL query: SELECT p.ID, p.post_title, m.meta_id, m.meta_key, m.meta_value FROM `wp_posts` p LEFT JOIN `wp_postmeta` m ON p.ID = m.post_id WHERE m.meta_key = ‘wpcf-show-status’ AND m.meta_value ” ORDER BY p.post_title ASC This query will create a list with ID, […]

Read more MySQL Query to List WordPress Posts Using Meta Query

[How to] Add User to WordPress using SQL INSERT

If you want to add a new user to WordPress database using MySQL using phpMyAdmin or a similar tool, you can use the following snippet: INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES (‘admin’, ‘$P$Bg/Ol6U.M07OGU7sKEZvIyl.mxuQQw.’, ‘admin’, ‘[email protected]’, ”, ‘2018-12-21 16:34:15’, ”, 0, ‘admin’); This will add admin user with password […]

Read more [How to] Add User to WordPress using SQL INSERT

[How to] Add Editor Style To Your Theme

WordPress allows theme developers to define custom CSS styles for visual editor on the post edit screen. Although, this theme development stage is often skipped by developers, it is very critical for end users to feel home when they are composing amazing posts. To add editor style to your theme, all you have to do […]

Read more [How to] Add Editor Style To Your Theme