{"id":5343,"date":"2018-07-29T12:19:09","date_gmt":"2018-07-29T10:19:09","guid":{"rendered":"https:\/\/florianbrinkmann.com\/en\/?p=5343"},"modified":"2020-02-09T10:59:27","modified_gmt":"2020-02-09T09:59:27","slug":"wordpress-weekly-recap-registering-metadata-in-4-9-8","status":"publish","type":"post","link":"https:\/\/florianbrinkmann.com\/en\/wordpress-weekly-recap-registering-metadata-in-4-9-8-5343\/","title":{"rendered":"WordPress weekly recap #30: Registering metadata in 4.9.8 and more"},"content":{"rendered":"\n

WordPress 4.9.8 introduces a way to register metadata for specific object subtypes, instead of only for whole object types like all post types.<\/p>\n\n\n\n

As I needed to skip the last two recaps, I will include posts from that two weeks, which I think are important enough, with the posts from the current week 30 into this post.<\/p>\n\n\n\n\n\n\n\n

Core<\/h2>\n\n\n\n

Registering metadata in 4.9.8<\/h3>\n\n\n\n

WordPress 4.9.8 adds the ability to register metadata for a specific object subtype, like a specific post type, instead only for a specific object type.<\/p>\n\n\n\n

To achieve that, the register_meta()<\/code> function now supports a object_subtype<\/code> argument in the args array. Additionally, there are two new functions register_post_meta()<\/code> and register_term_meta()<\/code> that take the post type or taxonomy as the first parameter, followed by the meta key and additional arguments as an array. Internally, they are wrappers for register_meta()<\/code> and are the recommended way to register meta for post types and terms.<\/p>\n\n\n\n

More information on that can be found in the post \u00bbRegistering Metadata in 4.9.8<\/a>\u00ab by Felix Arntz.<\/p>\n\n\n\n

Misc<\/h3>\n\n\n\n