WordPress.org

Ready to get started?Download WordPress

Forums

Postie
[resolved] Adding postmeta (5 posts)

  1. elforesto
    Member
    Posted 1 year ago #

    I'm currently working on trying to add metadata to a post via filterPostie.php and it doesn't seem to quite be taking. I'm making the assumption that the filter is run at the end of Postie processing. Is that an incorrect assumption? If so, what would be the proper way to append metadata to the $post object?

    Code: http://pastebin.com/j3q7zT9p

    (FYI, the original version would return true.)

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

  2. Wayne Allen
    Member
    Plugin Author

    Posted 1 year ago #

    while(!is_plugin_active("geo-my-wp/geo-my-wp.php")) {
        usleep(100);
    }

    Not sure why you're doing usleep here. Just return $post; if geo-my-wp isn't active.

    Otherwise it seems fine.

    >FYI, the original version would return true
    The filter should always return the $post array otherwise the post will be removed.

  3. elforesto
    Member
    Posted 1 year ago #

    The debug log shows no errors, but it doesn't look like the post meta gets updated either. I checked the wp_postmeta table and don't see any entries in there. I see this at the top of the debug output:

    memory at start of e-mail processing:21528616
    Array
    (
        [add_meta] => no
        [admin_username] => admin

    I don't see anywhere in the output where add_meta gets toggled to yes. Any ideas?

  4. elforesto
    Member
    Posted 1 year ago #

    Wait, it looks like I did something wrong. I was expecting a post object and not an array. I reviewed the sample code and it looks like I was pulling the ID incorrectly.

    Doesn't work:

    $post->ID

    Does work:

    $post['ID']

    The meta fields are getting created now.

  5. Wayne Allen
    Member
    Plugin Author

    Posted 1 year ago #

    Ahh the little things. I missed that as well.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic