- This topic has 3 replies, 2 voices, and was last updated 1 year, 7 months ago by .
-
Topic
-
My first simple custom fields went well. The second, not well at all. I can’t find the right spot to see how post (draft, publish, private publish) work with MB draft and publish, so it may related to that. Anyway, here’s my code:
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $meta_boxes[] = array ( 'title' => 'Untitled Meta Box', 'id' => 'untitled-meta-box', 'post_types' => array( 0 => 'post', ), 'context' => 'normal', 'priority' => 'high', 'fields' => array( array ( 'id' => 'gvr_test_text_1', 'type' => 'text', 'name' => 'gvr test text 1', 'std' => 'gvr test text 1', ), array ( 'id' => 'gv2_test_textarea_2', 'type' => 'textarea', 'name' => 'Textarea Field', 'std' => 'gv2 test textarea 2', ), ), ); return $meta_boxes; }
They show up, along with the proper values – but only after publishing in MB – which makes me wonder what draft is for.
Also don’t know if the status of a Post matters – if it’s draft, published or private published. Since I don’t really want to sent out a test post to my readers, I’ve been using draft, private post, and unsaved changes to previously published posts. Does that matter? From some of the other forum replies, sounds like it might – but again I can’t find the sport that documents this.When editing a post, the fields / values show up in the MB area in the editor (I use classi mode with TinyMCE Advanced, not Gutenberg). However, unlike my first fields, the Ultimate Short Codes plugin does not display the values.
USC plugin codes:
start
[su_meta key=”gvr_non_amp_txt” default=”data not found” before=”pre txt” after=”post txt”]
[su_meta key=”gvr_non_amp_msg_1″ default=”data not found” before=”pre msg_1″ after=”post msg_1″]
endall I get on preview is:
start
pre txtdata not foundpost txt pre msg_1data not foundpost msg_1
end
Weird that it’s not found, since the fields and the data are displayed properly in the MB area Untitled Meta Box.
What am I doing wrong, and where can I go to get more info on how this actually works?
thanks,
chris
- You must be logged in to reply to this topic.