Tagged: 

Viewing 7 reply threads
  • Author
    Posts
    • #5192
      shayneol
      Member

      I have a new installation of WordPress (v.4.3.1) and Piklist v.0.9.9.7.

      After adding values to my fields (I’ve tried editor, text, and file upload fields so far) and saving the post, the values will not update. I cannot change/delete any text or remove/uploaded images once the post has been saved.

      Here Is The Test Code That I Am Using (copied straight from the Piklist plugin demo folder):

      <?php
      /*
      Title: Editor Examples
      Post Type: page
      Order: 100
      */
      
        piklist('field', array(
          'type' => 'editor'
          ,'field' => 'post_content'
          ,'required' => true
          ,'label' => __('Post Content', 'piklist-demo')
          ,'description' => __('This is a replacement for the post_content editor', 'piklist-demo')
          ,'value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
          ,'options' => array(
            'wpautop' => true
            ,'media_buttons' => true
            ,'shortcode_buttons' => true
            ,'teeny' => false
            ,'dfw' => false
            ,'tinymce' => array(
              'resize' => false
              ,'wp_autoresize_on' => true
            )
            ,'quicktags' => true
            ,'drag_drop_upload' => true
          )
        ));
      
        piklist('field', array(
          'type' => 'text'
          ,'field' => 'text'
          ,'label' => __('Text', 'piklist-demo')
          ,'help' => __('You can easily add tooltips to your fields with the help parameter.', 'piklist-demo')
          ,'attributes' => array(
            'class' => 'regular-text'
          )
        ));
      
        piklist('field', array(
          'type' => 'file'
          ,'field' => 'upload_media'
          ,'scope' => 'post_meta'
          ,'label' => __('Media Uploader', 'piklist-demo')
          ,'options' => array(
            'modal_title' => __('Add File(s)', 'piklist-demo')
            ,'button' => __('Add', 'piklist-demo')
          )
        ));
      
      ?>
      

      To make sure it wasn’t my theme, I’ve tried this code on the Twenty Fifteen theme and had all other plugins disabled. Another weird thing is that everything seems to be working fine if the fields are in a Group. I was successfully using the following code before I noticed the above mentioned issue:

      <?php
      /*
      Title: Sections
      Post Type: page
      Order: 20
      ID: 2
      */
        
      ?>
      
      <div class="piklist-demo-highlight">
        <?php _e('Individual Homepage Sections', 'piklist-demo');?>
      </div>
      
      <?php
      
        piklist('field', array(
          'type' => 'group'
          ,'field' => 'sections'
          ,'label' => 'Homepage Sections'
          ,'columns' => 12
          ,'add_more' => true
          ,'fields' => array(
            array(
      		'type' => 'colorpicker'
      		,'field' => 'bg_color'
      		,'label' => 'Background Color'
              ,'columns' => 12
            )
      	  
            ,array(
      		'type' => 'html'
      		,'label' => __('<div style="width:100%; height:1px; background:#d1d1d1; margin-top:-10px; margin-bottom:-30px;"></div>', 'piklist-demo')
            )
      
            ,array(
      		'type' => 'text'
      		,'field' => 'title'
      		,'label' => 'Section Title'
      		,'help' => 'Leave blank if no section title is needed.'
              ,'columns' => 12
      		,'attributes' => array(
      			'class' => 'regular-text'
      		)
            )
      	  
            ,array(
      		'type' => 'html'
      		,'label' => __('<div style="width:100%; height:1px; background:#d1d1d1; margin-top:0px; margin-bottom:-30px;"></div>', 'piklist-demo')
            )
      	  
            ,array(
      		'type' => 'editor'
      		,'field' => 'subtitle'
      		,'label' => 'Subtitle'
      		,'help' => 'Leave blank if no subtitle is needed. Multiple lines are allowed.'
      		,'options' => array(
      			'wpautop' => true
      			,'media_buttons' => true
      			,'shortcode_buttons' => true
      			,'teeny' => false
      			,'dfw' => false
      			,'tinymce' => array(
      				'resize' => false
      				,'wp_autoresize_on' => true
      			)
      			,'quicktags' => true
      			,'drag_drop_upload' => true
      			)
      		)
      	  
            ,array(
      		'type' => 'html'
      		,'label' => __('<div style="width:100%; height:1px; background:#d1d1d1; margin-top:0px; margin-bottom:-30px;"></div>', 'piklist-demo')
            )
      
            ,array(
      		'type' => 'select'
      		,'field' => '_' . piklist::$prefix . 'relate_post'
      		,'label' => 'Choose Page Content From'
      		,'choices' => piklist(
      			get_posts(array(
      				'post_type' => 'page'
      				,'numberposts' => -1
      				,'orderby' => 'title'
      				,'order' => 'ASC'
      			))
      			,array('ID', 'post_title')
      		)
      		,'relate' => array(
      			'scope' => 'post'
      		)
            )
      
          )
        ));
      
      ?>
      

      I have recorded a screencast of what is happening if this helps. I will send it to piklist support.

      Thanks

    • #5193
      Steve
      Keymaster

      @shayneol– Thanks for sending the screencast.

      Do the built-in demos save?

    • #5195
      shayneol
      Member

      Hmmm…I just tried all of the fields under the “Common” tab in the built-in demo. They all work correctly.

    • #5196
      Steve
      Keymaster

      Let’s try a few things:

      1) Change ,'field' => 'post_content' to any other field name. The default editor field is also called post_content.
      2) Same with ,'field' => 'upload_media'. Change that as well.
      3) Remove ,'scope' => 'post_meta', you don’t need it since you are already on a post screen.

      Let us know if that helps.

    • #5197
      shayneol
      Member

      Hey Steve,

      I’ve tried the following:
      ,'field' => 'post_content_02'
      ,'field' => 'text_02'
      ,'field' => 'upload_media_02'

      I also removed ,'scope' => 'post_meta' as you mentioned. I’m still having the same issue. Also note that these fields are on an actual page not a post. My apologies for typing “post” in the initial description. I haven’t tried testing this issue on a blog entry or custom post type yet, only a main website page.

      Thanks

    • #5244
      Steve
      Keymaster

      Do the built-in Piklist Demos work?

    • #5257
      shayneol
      Member

      Hey Steve,

      Even though I was already working with a fresh copy of WordPress, I had to delete everything and start with a new copy to get my custom fields to work. I’m not sure what was going on or why they weren’t working before…I guess you can close this ticket.

    • #5262
      Steve
      Keymaster

      @shayneol– That’s odd. Let us know if you have other issues.

Viewing 7 reply threads
  • The topic ‘Fields cannot be updated after saving post’ is closed to new replies.