3

I am trying to pick up an in-depth understanding of how post-formats relate to posts 'in the database' - i.e. what meta information when compiled together constitutes a post format. And yes, I do mean a post format (NOT a post type).

All of the documentation I can find assumes a starting point where post_format is selected from the meta box on the 'New Post' page. I'm working with a plugin (wootumblog) which uses a custom 'save_post' function, so need to understand more about how this actually works.

I see several tables involved including *wp_terms* (where the post_format slug is referenced against term_id) and *wp_term_relationships* (where the term_id is referenced against the post_id or object_id as the column is named) but I'm unclear as to whether wp_postmeta needs to be updated or are these two 'terms' tables sufficient for wordpress to work with?

I basically have a problem integrating the wootumblog and wpmu sitewide tags plugins together, and suspect this may be caused by the different protocols they use to save a post.

This seems a pretty barren area for documentation, so if someone speaks the post format lingo, it would be really useful to outline how it all works at a 'data' level.

1 Answer 1

6

Post format for the post is term of native post_format taxonomy.

It can be set for the post by set_post_format() function. As with any taxonomy you can also use some deeper level function, but really there is no need. And I definitely don't recommend to try and deal with terms and taxonomies directly in database (sanity at risk).

Core seems to be setting it in edit_theme() function.

6
  • Thanks for that link, that's what I thought. The wootumblog plugin uses set_post_format() when creating a new post, however the wpmu sitewide tags plugin uses wp_get_object_terms( $post_id, $tax, array( 'fields' => 'names' ) ) which feels like it's achieving something quite different. The end result is that SWT pages plugin does not pick up the post format when creating the entry in the tags blog.
    – DoctorDR
    May 30, 2011 at 21:08
  • @DoctorDR sorry, I have no idea about that plugin's purpose/functionality so you lost me there :)
    – Rarst
    May 30, 2011 at 21:15
  • The wootumblog plugin uses a custom dashboard widget to publish new posts - as asides, video, image, quote, link.. wordpress.org/extend/plugins/woo-tumblog whilst the wpmu sitewide tags plugin is used on a Wordpress multisite installation to aggregate blog posts from across the network into a single 'tags blog' which can then display a list of network-wide posts or global tags - wordpress.org/extend/plugins/wordpress-mu-sitewide-tags. The sitewide tags plugin reads the source blog and then creates a duplicate entry with 'just' enough meta data in the main blog.
    – DoctorDR
    May 30, 2011 at 22:09
  • @DoctorDR does plugin tries to fetch post format and fails? or doesn't try at all? Getting post format is as easy with get_post_format()...
    – Rarst
    May 30, 2011 at 22:18
  • That's the nub of my question really - the wpmu sitewide tags plugin contains no get_post_format() instructions, instead the call it uses for such meta data is wp_get_object_terms, so I'm asking whether this is why the process fails to replicate the data successfully.
    – DoctorDR
    May 31, 2011 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.