Org2Blog: Access Post Metadata After Publishing

Via here:

Now your post or page exists both in your Org-Mode file on your computer, and also in WordPress itself. That page or post inside of WordPress contains a lot of metadata and you might be interested in some of it. Here is documentation covering all of the fields. You can easily access that data using a hook function.

After publishing your post or page, Org2Blog calls the functions in org2blog/wp-after-new-post-or-page-functions passing them the post or page metadata. Maybe you’ve never seen a hook function like this before because it takes an argument. They are still just plain old functions. Here they need to accept one argument so that Org2Blog can give you that metadata. It is pretty simple.

Here is an example that displays your post or page information in the *Messages* buffer:

(add-hook 'org2blog/wp-after-new-post-or-page-functions (lambda (p) (pp p)))
(("dateCreated" :datetime
  (22918 5912))
 ("userid" . "1")
 ("postid" . 10648)
 ("description" . "<p> Glad to know that Go has a <a href=\"\">Planet</a> feed. </p>")
 ("title" . "(Go Lang) Introducing Planet Golang")
 ("link" . "")
 ("permaLink" . "")
 ("categories" "Article")
 ("mt_allow_comments" . 1)
 ("mt_allow_pings" . 1)
 ("mt_keywords" . "Go Lang, Programming Language")
 ("wp_slug" . "go-lang-introducing-planet-golang")
 ("wp_author_id" . "1")
 ("wp_author_display_name" . "Grant")
 ("date_created_gmt" :datetime
  (22918 27512))
 ("post_status" . "publish")
 ("wp_post_format" . "standard")
 ("date_modified" :datetime
  (22918 6039))
 ("date_modified_gmt" :datetime
  (22918 27639))

2 thoughts on “Org2Blog: Access Post Metadata After Publishing”

Leave a Reply

Your email address will not be published. Required fields are marked *