Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #3643
      liquidws
      Member

      Hello.. am I doing something wrong with the code below? The text field saves the data no problem, but the Editor Field will not save the data. Please help. Thank you in advance.

      <?php
      /*
      Title: Careers
      Description: Description of Meta-Boxes for Careers
      Post Type: careers
      Priority: high
      Locked: true
      Order: 1
      */
      
      piklist('field', array(
      	'type' 		=> 'text'
      	,'field' 	=> 'careers_accepting'
      	,'label' 	=> 'Accepting Applications Yes/No'
          ,'columns' 		=> 10
          ,'attributes' 	=> array(
            'placeholder' => 'Accepting Applications / Not Accepting Applications At This Time'
          )
      ));
      
      piklist('field', array(
      	'type' 			=> 'editor'
      	,'scope' 		=> 'post'
      	,'field' 		=> 'careers_description'
      	,'label' 		=> __('Career Description')
      	,'description' 	=> __('Enter the desciption of the Career.')
      	// ,'value' 		=> 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
      	,'options' 		=> array (
      		'wpautop' 			=> true
      		,'media_buttons' 	=> false
      		,'tabindex' 		=> ''
      		,'editor_css' 		=> ''
      		,'editor_class' 	=> ''
      		,'teeny' 			=> false
      		,'dfw' 				=> false
      		,'tinymce' 			=> true
      		,'quicktags' 		=> true
      	)
      ));
    • #3644
      Steve
      Keymaster

      @liquidws– In most cases the “scope” of the field is the database table you are saving it to. You are setting the scope to “post”, which is the WordPress posts table… wp_posts. Which is fine, if you use any of the fields WordPress allows. Which in your case would probably be post_content or post_excerpt. But you are saving it to a custom field, careers_description, which is not allowed in wp_posts… but is allowed in wp_postmeta.

      Just remove the scope parameter and Piklist will figure it out and save it properly.

      You can see the full WordPress database schema here >

Viewing 1 reply thread
  • You must be logged in to reply to this topic.