{"id":7208738,"date":"2016-03-25T18:38:15","date_gmt":"2016-03-25T18:38:15","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/sorting-categories-in-the-post-edit-page\/"},"modified":"2016-08-31T15:06:20","modified_gmt":"2016-08-31T15:06:20","slug":"sorting-categories-in-the-post-edit-page","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/sorting-categories-in-the-post-edit-page\/","title":{"rendered":"Sorting categories in the post-edit page"},"content":{"rendered":"<p>Tell me please, how can I do additional button on the categories checklist on \u201cpost-edit\u201d page that will sort categories by time of creation? <\/p>\n<pre><code>add_filter( &#039;get_terms_args&#039;, &#039;sortadmincats&#039;, 10, 2);\nfunction sortadmincats( $args, $taxonomies)\n{\n    global $pagenow;\n    if( !is_admin() || (&#039;post.php&#039; != $pagenow &amp;&amp; &#039;post-new.php&#039; != $pagenow) )\n        return $args;\n\n    $args[&#039;orderby&#039;] = &#039;term_id&#039;;\n    $args[&#039;order&#039;] = &#039;DESC&#039;;\n\n    return $args;\n}<\/code><\/pre>\n<p>This code sorts the categories in way that I need. But this action should to implement by click.<\/p>\n","protected":false},"template":"","class_list":["post-7208738","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7208738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7208738\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7208738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}