How I could made a sql query who retrieve all the sticky post in a wordpress database? This is because we use a new app over the old wordpress website database, and I don't know where Wordpress "store" the sticky attribute.
Thanks in advance
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
In raw SQL it would look like this:
SELECT option_value FROM `wp_options` where option_name = 'sticky_posts'
It will return string similar to:
Which means that posts with IDs: 27935 and 33322 are "sticky". If there are no sticky posts the returned string will look as follows:
For more details about Wordpress serialized data structure view https://codex.wordpress.org/Function_Reference/maybe_serialize
Anyway if you are developing custom theme or plugin it's much better to use snippet provided by @Rarst than writing custom queries.