One of my ways of keeping my posts up to date is to update the post_modified value after some of certain actions like commenting, liking… You shouldn’t use wp_update_post() because it calls wp_insert_post(), which determines that the post exists and sets the post_modified and post_modified variables to the current date. This process will take way… Continue reading How to update post_modified FAST after each comment?
WordPress functions like: will serialize data automatically before adding to the MySQL, so the the data will be stored as serialized string: If you are using PODS to create metadata, somehow it causes the function not to be serialized correctly, so you have to use the function then If you want to get back the… Continue reading update_term_meta() not serializing array? Fixed
To get the author ID from a post ID, use this code:
I’m developing a simple “trending hashtags”, which based on tags were used by recent posts. The result will be: pid tags postid2 tag1,tag2,tag3 postid1 tag1,tag5,tag6 GET TAGS BY RECENT POSTS Here is the MySQL:
If you want to display custom post type posts along with “default” posts in latest posts page, category page, archive page or tag page, you could you this function. Basically it will add custom post types to the main query before looping: Where Do I Put This Code? This code should be placed in the… Continue reading Add Custom Post Type to the main query
If you’re using wp_login_form() inside a custom function and you don’t want wp_login_form() to echo, which is by default, you shoud set the echo to false as following: Where Do I Put This Code? This code should be placed in the functions.php file of your active theme or a custom functions plugin.
If you want to build a custom login page by using the builtin WP function wp_login_form(), you will notice that there is no register or forgot password link. If you want to take them back, just hook these links as following: There are 3 hooks available: login_form_top login_form_middle login_form_bottom Where Do I Put This Code? This… Continue reading Add register/forgot password links to wp_login_form()
Update: Better one here https://voila-blog.com/mysql-get-tags-taxonomy-by-recent-posts-in-wordpress-db/ (MySQL) If you want to display the most recent tags in WordPress, apply this code to the current theme’s functions.php In my case, I will get 20 most recent tags by using the shortcode: [most_recent_tags limit=20]
Apply this code in functions.php of the current theme: