Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: Validation always succeeds on custom post type #7771
    ssimo3
    Participant

    Does not work.

    in reply to: Validation always succeeds on custom post type #7766
    ssimo3
    Participant

    Yes.

    in reply to: Validation always succeeds on custom post type #7764
    ssimo3
    Participant

    I don’t have one at the moment. The validation is passing even on the ‘url’ rule alone.

    in reply to: Validation always succeeds on custom post type #7762
    ssimo3
    Participant

    My theme’s functions.php file has this:

    add_action('init', 'my_init_function');
    function my_init_function(){
      if(is_admin()){
       include_once('class-piklist-checker.php');
     
       if (!piklist_checker::check(__FILE__, 'theme')){ //use 'theme' parameter when included in a theme
         return;
       }
      }
    }
    
    function piklist_event_post_types($post_types)
      {
    	$post_types['event'] = array(
    	  'labels' => piklist('post_type_labels', 'Event')
    	  ,'title' => __('Enter a new Event Title')
    	  ,'menu_icon' => piklist('url', 'piklist') . '/parts/img/piklist-menu-icon.svg'
    	  ,'page_icon' => piklist('url', 'piklist') . '/parts/img/piklist-page-icon-32.png'
    	  ,'supports' => array(
    		'title'
    		,'post-formats'
    	  )
    	  ,'public' => true
    	  ,'admin_body_class' => array(
    		'custom-body-class'
    	  )
    	  ,'has_archive' => true
    	  ,'rewrite' => array(
    		'slug' => 'event'
    	  )
    	  ,'capability_type' => 'post'
    	  ,'edit_columns' => array(
    		'title' => __('Event')
    		,'author' => __('Assigned to')
    	  )
    	  ,'hide_meta_box' => array(
    		'author'
    	  )
    	  ,'status' => array(
    		'new' => array(
    		  'label' => 'New'
    		  ,'public' => false
    		)
    		,'pending' => array(
    		  'label' => 'Pending Review'
    		  ,'public' => false
    		)
    		,'event' => array(
    		  'label' => 'Event'
    		  ,'public' => true
    		  ,'exclude_from_search' => true
    		  ,'show_in_admin_all_list' => true
    		  ,'show_in_admin_status_list' => true
    	   )
    		,'lock' => array(
    		  'label' => 'Lock'
    		  ,'public' => true
    		)
    	  )
    	);
    	return $post_types;

    And my meta box has this:

    piklist('field',array(
        'name' => 'email',
        'type' => 'text',
        'label' => 'E-mail',
        'validate' => array(
              array(
                   'type' => 'email'
              )
         )
    ));
    in reply to: Validation always succeeds on custom post type #7760
    ssimo3
    Participant

    I should add that it also always passes when I remove both the validation rule and its implementation from my code, i.e., there is no add_filter(‘piklist_validation_rules’…) and the only validate parameter in my form is “email.” Something else is going on here. The person who was having this problem in the past was writing a plugin. I do not know how to write WordPress plugins. I know only how to modify a theme. But does validation even work when registering a post with a theme?

    Stuart

Viewing 5 posts - 1 through 5 (of 5 total)