WordPress.org

Ready to get started?Download WordPress

Forums

Postie
[resolved] add_post_meta vs. update_post_meta (6 posts)

  1. elforesto
    Member
    Posted 1 year ago #

    Does filterPostie.php work with update_post_meta or just add_post_meta? The WP codex says that you can call update_post_meta and if it doesn't find anything to update, it will fall back on add_post_meta, but that does't seem to be happening in my filterPostie.php. I'm calling a function from another plugin that uses update instead of add.

    http://wordpress.org/extend/plugins/postie/

  2. Wayne Allen
    Member
    Plugin Author

    Posted 1 year ago #

    Can you post the code?

  3. elforesto
    Member
    Posted 1 year ago #

    Here's the current code I've written: http://pastebin.com/9T7p5ABX

    The Geo My WP plugin is premium, so I don't think I can share their code without breaking the license agreement. Internally, it runs a series of update_post_meta calls, then it executes its own query to drop location data into wp_places_locator. Neither of these seems to work when I call gmw_pt_update_location() within filterPostie.php, but I don't get any PHP errors either. If the post ID is false when it runs, it gracefully exits.

  4. Wayne Allen
    Member
    Plugin Author

    Posted 1 year ago #

    The issue is that the filter is called before the post is created so that a Postie AddOn has a chance to fiddle the data before the post is created.

    I've added a new filter in 1.5.14 "postie_post_after" which is called after the post is created.

  5. elforesto
    Member
    Posted 1 year ago #

    It works perfectly now. Thanks! I've updated the code in the link above to reflect the final and working version. It also includes notes on version requirements. Feel free to use, reuse, and distribute as needed.

  6. Wayne Allen
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks! Glad to hear it is working.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic