Viewing 2 reply threads
  • Author
    Posts
    • #6277
      cannect
      Member

      I do not know if this is normal, but I have it two times already. I create a metabox, then I change something. In this case the post type name, and then my metabox disappears.

      I am creating Project Categories:

      // Project Category type
      add_filter('piklist_post_types', 'project_category_post_type');
      function project_category_post_type( $post_types )
      {
          $post_types['project_category'] = array(
              'labels' => piklist('post_type_labels', 'Project Category')
          ,'public' => true
          ,'rewrite' => array(
                  'slug' => 'project_category'
              )
          // etc.
      
          return $post_types;
      }

      What I did was to change the ‘project_category’ string in the code above and in the code below. After that change the metabox below did not show when I choose ‘Project Categorie’ -> ‘New’ in the WordPress Admin.

      Metabox in parts/meta-boxes:

      
      <?php
      /*
      Title: Create Project Category
      Description: Create a new project category
      Post Type: project_category
      Collapse: false
      */
      
      piklist('field', array(
          'type' => 'text',
          'field' => 'category',
          'label' => 'Category name',
          'description' => 'The name of the category to group the project items',
          'columns' => 5
      ));
      

      Someone any clue how to ‘reset’ piklist to recreate the piklist post types and metaboxes?

    • #6284
      Jason
      Keymaster

      Hi! Unless something odd is caching, that isn’t something that is “reset”. Post types are registered every time WordPress handles a request, they’re not stored in the database. So if you change the post type it should be effective immediately. Make sure you’re changing the $post_types[] index, as that’s the string used for the registration, it’s not the slug.

    • #6291
      cannect
      Member

      Thanks @Jason,

      At the moment I got it working again. Strange, but in my case it did help to remove the old posts in database and the transients.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.