{"id":2012,"date":"2011-11-10T22:57:37","date_gmt":"2011-11-11T03:57:37","guid":{"rendered":"http:\/\/journal2.alanv.org\/?p=2012"},"modified":"2012-10-07T22:00:13","modified_gmt":"2012-10-08T02:00:13","slug":"wordpress-post-format-hackery","status":"publish","type":"post","link":"https:\/\/journal2.alanv.org\/?p=2012","title":{"rendered":"WordPress post format hackery"},"content":{"rendered":"<p>So I&#8217;m in the process of converting <a href=\"http:\/\/junk.alanv.org\">Randomjunk<\/a> over to a WordPress blog, since it seems the main thing I use it for nowadays is quotes (which used to be stored way down under my AIM subprofile that no one uses anymore).<\/p>\n<p>After several hundred posts, I noticed that there was an option for post format, one of which was the &#8220;Quotes&#8221; type. Unfortunately, WordPress 3.2 mass edit does not include a way to mass update post formats. Therefore, to the SQL.<\/p>\n<p>All of the posts I wanted to convert already had a tag called &#8220;Quotes&#8221;. Looking in the database in the wp_terms table told me the number of this tag.<br \/>\n<code>SELECT term_id FROM `wp_terms` WHERE name='Quotes';<\/code><br \/>\nThis ended up being 9.<\/p>\n<p>I also got the term id for the post format I wanted.<br \/>\n<code>SELECT term_id FROM `wp_terms` WHERE name='post-format-quote';<\/code><br \/>\nThis ended up being 86.<\/p>\n<p>Therefore, I just run this query on the relationships table:<br \/>\n<code><br \/>\nINSERT INTO `wp_term_relationships`(object_id, term_taxonomy_id, term_order) SELECT object_id, 86, 0 FROM `wp_term_relationships` WHERE term_taxonomy_id=9;<\/code><\/p>\n<p>I also needed to fix up the term_taxonomy table<br \/>\n<code>SELECT count(1) FROM `wp_term_relationships` WHERE term_taxonomy_id=86;<\/code><br \/>\ngave me 337 rows, so<br \/>\n<code>UPDATE `wp_term_taxonomy` SET count=337 WHERE term_taxonomy_id=86;<\/code><\/p>\n<p>Done. Yay.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;m in the process of converting Randomjunk over to a WordPress blog, since it seems the main thing I use it for nowadays is quotes (which used to be stored way down under my AIM subprofile that no one &hellip; <a href=\"https:\/\/journal2.alanv.org\/?p=2012\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-2012","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts\/2012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2012"}],"version-history":[{"count":0,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=\/wp\/v2\/posts\/2012\/revisions"}],"wp:attachment":[{"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/journal2.alanv.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}