WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Adding postmeta

[Resolved] Adding postmeta

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Wayne Allen
    Participant

    @wayneallen-1

    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.

    elforesto
    Member

    @elforesto

    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?

    elforesto
    Member

    @elforesto

    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.

    Plugin Author Wayne Allen
    Participant

    @wayneallen-1

    Ahh the little things. I missed that as well.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Adding postmeta’ is closed to new replies.