[resolved] how to set post to sticky (IN PHP) ? (5 posts)

  1. wpprogrammeurs.nl
    Posted 3 years ago #

    Tried our local fora without results. Let's bring it up a notch :

    For a plugin dev (classyfrieds) I'm looking for a way to make an existing post sticky (and preferably change the publishing date to current date).

    I use wp_update_post() to modify all kinds of things on existing posts, but the stickyness eludes me.

    (In the ideal world I'm also looking for the code to un-stick a post, but assume that the light will turn on once I know how to sticky a post first).

    codex,bing & google turned out not to be my friends in this matter.

  2. Jerry
    Posted 3 years ago #

    If i'm not mistaken, you must be using the Twenty Eleven theme, or maybe another theme that supports stickies. The thing is, since "sticky" isn't a standard, or at least I haven't seen it in many themes, that leads me to believe that it's more like post_meta data.

    To verify I'd find a post that has the "stick" option set, then dump it's metadata to the screen.

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    Uh? "sticky" is part of WordPress core.

  4. wpprogrammeurs.nl
    Posted 3 years ago #

  5. Jerry
    Posted 3 years ago #

    @esmi: haha you can tell that I don't mess with that portion of WP, thanks for the insight though. That will definitely save me from writing extra unnecessary code.

Topic Closed

This topic has been closed to new replies.

About this Topic