0

In WordPress we can pin (sticky) a post.
Wordpress uses an option in wp_options table named 'sticky_posts' with an array list of sticky posts!

As a normal condition WordPress should add a field named 'sticky' in wp_posts table.

My question is why does WordPress use this way and what are Pros and Cons of this method?

5

Sticky posts are a feature of the home page, not of the post. The post has no reason to "know" it is sticky. The home page OTOH do not have any formal form of storage and therefor traditionally options related to it are stored in the options table

  • is there any performance benefits in this method? – Ramin Firooz Apr 13 '16 at 5:42
  • @RaminFirooz compared to what? – Mark Kaplun Apr 13 '16 at 5:59
  • using a 'sticky' field in wp_posts table – Ramin Firooz Apr 13 '16 at 6:09
  • Well, when someone will write the code that does it like you say we will be able to compare, no? Why don't you just ask the question you actually want to ask instead of using a proxy? This feature was done like that because it was done like that, not every small piece of code is analyzed 10 times to be "best" in something. – Mark Kaplun Apr 13 '16 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.