Hot answers tagged

2

Storing of your own meta fields is typically a custom process, more so if you are using a third party framework. Technically it's possible, but clunky: Hooking into save_post would allow you to check if meta is added to it If so you can immediately query for previous (if any) post that had it and unset the meta for it However I concur with the comment ...


1

Template files are not the right place to add in functions like that. The template file isnt loaded until late in the hook/filter process. Your function should be in functions.php. This way it can be added in before your tempalte files load, and functions that are in use in them can be altered. Often times wp_title() is used in the header.php so it possible ...


1

You should always use update_post_meta() function because if the term doesn't exist it will make a call to the add_post_meta() automatically. The same goes for update_user_meta(). Example if you want to add the meta "City" but you don't have it in the db you simply make a update_post_meta($city) and in $city you need the post_id and the new value for city....



Only top voted, non community-wiki answers of a minimum length are eligible