• I create custom WP_list_table with side form like (adding new category form), but when i submit that form wp_list_table doesn’t refresh. When I once again refresh page information appears.I use wp_list_table_example plugin everything is the same except for geting example_data.

    function prepare_items() {
            $data = array();
            $example_data = array();
        $terms = get_terms( 'productcat', array('hide_empty' => false));
    
            if ( ! empty( $terms )  ){
         foreach ( $terms as $term ) {
               $data[] = array(
    							'ID'          =>  $term->term_id,
    							'title'       => $term->name
    							);
    
         }
     }
    
            $example_data = $data;

    When I once again refresh page information appears, I’m adding new taxonomy like this on form submit

    $new_term =  $_POST['term'];
            $description = $_POST['description'];
            wp_insert_term(
              $new_term,
              'productcat',
                array(
        'description'=> $description,
      )
            );

    Is it in the way of passing and receiving data problem, and how to submit form and refresh wp_list_table.

  • The topic ‘WP_list_table prepare_items()’ is closed to new replies.