Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

How to automate featured posts number? [duplicate]

The problem is that you misuse the category field.

Use a site meta field (array) and a simple checkbox on each post. When a post is saved add its ID to the site meta array, and if the array is longer than 5 drop the last ID from it. The query for featured post will then just take the post IDs from the meta field and you will never have to uncheck something manually.

Related Posts:

  1. Code to make a post sticky
  2. How to display only feautured/sticky listings on the homepage
  3. Keep featured content post in homepage with original order
  4. How to check if post meta key exists or not in wordpress database
  5. How to add category to: ‘wp-admin/post-new.php’?
  6. How can I retrieve multiple get_post_meta values efficiently?
  7. WP_Query: Why is sticky post not first item in loop?
  8. How to allow hidden custom fields to be added from wp-admin/post.php?
  9. Query *only* sticky posts
  10. Export WordPress Posts and Meta Information in CSV format
  11. Delete duplicated wp_postmeta record
  12. Highlight a Featured Post?
  13. Will a large postmeta table slow a site down?
  14. Update all posts automatically when using post_meta
  15. How to batch update post content with custom post meta value
  16. Change slug with custom field
  17. Include Sticky Post in Page Posts Count?
  18. Better post meta efficiency?
  19. featuring old articles without messing up with the archive
  20. Setting post meta data to random value during post status transition / on publish
  21. Display All Sticky Post Before Regular Post
  22. Edit meta data does’t work with custom sql
  23. Human Time Diff, change mins to minutes
  24. Change post format using custom field
  25. Does WP get all post_meta on POST page?
  26. Sanitizing `wp_editor();` Values for Database, Edit, and Display
  27. Exporting Data from WordPress into a flat table
  28. Adding Multiple Values to a Post Meta Key
  29. Using radio button meta data from a custom meta box
  30. PHP Notice error (when on 404 page)
  31. What Is meta_id In wp_postmeta?
  32. Checking if a post with certain meta value exists
  33. How to permanently delete a post meta entry?
  34. Add custom field automatically (add_post_meta) with value based on number of words of article
  35. How to generate numbers indistinguishable for the IDs of the posts
  36. Modify WP_Post before processing
  37. Save re-arranged draggable post items to wordpress database
  38. I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
  39. Change post_date to post_modified date on post template?
  40. Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
  41. Sticky post appears twice
  42. How can I sort posts by the date and a custom meta field?
  43. is there a way to show the the post title after the image?
  44. Get Meta Key Value While Saving Post
  45. Force the “Choose from the most used tags” meta box section to always be expanded
  46. Meta value does not save for scheduled posts
  47. Custom Posts Query and meta_query Sort Order
  48. Include sticky posts on the static page front page
  49. How to compare two posts including their meta fields on a scalable base?
  50. Getting value from get_post_custom
  51. Calling Different Custom Post Timestamps in a table
  52. Is it possible to paste a link without tags and make it directly a link in a post?
  53. Cannot retrieve a custom RSS field from posts
  54. Saving custom fields to a custom taxonomy
  55. Only display sticky post or latest post in custom loop
  56. Customize rel=canonical tag for single blog post
  57. Change all author links in Blog roll
  58. How to I retrieve the ID from the Posts page?
  59. How to save meta checkbox WordPress
  60. How to calculate the average of a post meta value(Numeric) of a specific author
  61. Is there any way to tell when wp_postmeta has been updated?
  62. wpColorPicker – problem with implementation to post meta
  63. Change post author without using wp_update_post()
  64. if in category but only with post meta
  65. wp_query with ajax
  66. Update post meta within save_post action
  67. Display post number by category
  68. Updating post meta for checkbox
  69. Saving Post Data in Another Database
  70. get_previous_post() while accounting for sticky posts
  71. Custom permalink for each post
  72. How can I tell if a post has been published at least once?
  73. Is there a way getting post fields using `transition_post_status`
  74. Automatic blog page with custom design [closed]
  75. Sticky Post from page 2 and on
  76. Add multiple meta keys to a post at once
  77. Show number of posts by logged in user
  78. How does WP decide how to display a page
  79. When sending a newsletter -not with wordpress- the server has 100% cpu [closed]
  80. Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
  81. Insert data from custom created PHP page into wp_postmeta table
  82. Issue with first top post display order
  83. Adding a meta box to determine the sidebar [closed]
  84. The loop starting at a certain ID
  85. saving/reading custom field value does not work – no value gets POSTed
  86. Simple Custom Metabox Not Saving
  87. Get post category as a separate string and url
  88. show div only if have a related post inside
  89. marking a post that was sticky on category template
  90. Featured Images most often doesnt appear
  91. Post meta not working
  92. Delete media from the post but keep my featured image and post
  93. How to bulk Update URLs to new values?
  94. Select another post in a post meta like a parent page is selected while editing a page
  95. SQL DELETE multiple post_meta on single and multi-sites
  96. Sticky Post Doesn’t always work
  97. WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
  98. How to pull sticky post permalink inside php?
  99. Private post caught in endless redirect loop
  100. How to mark only one post as Featured post?
Categories posts Tags featured-post, post-meta, posts, sticky-post
Plugin is not generating title tags on any pages or posts
this jQuery function works perfect in static html page but not on wordpress

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress