Add additional field to custom post_type

In your code, you are using: add_filter( ‘team_Meta_Box’, ‘team_sample_metaboxes’ ); On the site you linked to, they are using: add_filter( ‘cmb_meta_boxes’, ‘wpb_sample_metaboxes’ ); So my question is: did you change all instances of “cmb” to “team” in the init.php file? If you did, then the correct filter to use should be: add_filter( ‘team_meta_boxes’, ‘team_sample_metaboxes’ ); … Read more

Settings API – save multiple tabs at once

Don’t initialize defaults, or do an initial save. Just use sane defaults. For example, define an array of defaults: function wpse92323_get_option_defaults() { $defaults = array( ‘slug1’ => ‘default1’, ‘slug2’ => ‘default2’ ); return apply_filters( ‘wpse92323_option_defaults’, $defaults ); } Then, write a function to return an option value, that parses stored options against your defaults: function … Read more

get_post_meta() retrieves meta from a specific post on pages, not the page currently viewed

There is some other query which replaces the main post ID. Might be another widget, some strange plugin code or something else If you have no control over the context, collect the post ID earlier: add_action( ‘template_redirect’, ‘collect_post_id’ ); function collect_post_id() { static $id = 0; if ( ‘template_redirect’ === current_filter() && is_singular() ) $id … Read more