Accessing global $post from oembed_dataparse add_filter (2 posts)

  1. Aaron Ware
    Posted 4 years ago #

    Figure I should start with the goal. Maybe I am going about what I am trying to do the wrong way.

    I want to store the thumbnail of an oembed's $data in a separate post_meta. I don't want to overwrite or change the original _oembed_MD5 stored in the post_meta.

    I've looked through the codex and also the source at oembed_dataparse & oembed_result. But when I try to access global $post nothing is returned. I mainly need the $post->ID so I can update_post_meta($post->ID, 'oembed_thumb', $oembed_thumbnail);

    So I am wondering is it possibly a priority issue where it should be higher or lower than 10(the default)?
    Should I be using a different hook/filter.

    I was thinking I could add in a hook for post_save set a global var for $oembed_thumb = $data->thumbnail and when the oembed_dataparse happens reference the global $oembed_thumb. But I think that is pretty janky.

    Hopefully my explanation is clear.

  2. Eduardo Zulian
    Posted 3 years ago #

    Aaron, maybe I am too late, but maybe you should check out this piece of code!

Topic Closed

This topic has been closed to new replies.

About this Topic