I registered a custom post type like this:

function si_recipe_post_type()
    $labels = array(
        'name' => _x('Recipes', 'Post type general name', 'si-extend'),
        'singular_name' => _x('Recipe', 'Post type singular name', 'si-extend'),
        'menu_name' => _x('Recipes', 'Admin Menu text', 'si-extend'),

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'menu_position' => 6,
        'menu_icon' => 'dashicons-list-view',
        'show_in_rest' => true,
        'supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpts', 'revisions', 'custom-fields'),
        'show_ui' => true,
        'show_in_menu' => true,
        'query_var' => true,
        'has_archive' => 'recipe',

    register_post_type('recipe', $args);

add_action('init', 'si_recipe_post_type');

Then I added an overview to the backend, like this:

function set_custom_edit_recipe_columns($columns)
    $columns['difficulty'] = __('Difficulty', 'si-extend');
    $columns['custom_category'] = __('Category', 'si-extend');

    return $columns;

add_filter('manage_recipe_posts_columns', 'set_custom_edit_recipe_columns');

function custom_recipe_column($column, $post_id)
    switch ($column) {

        case 'difficulty' :
            $category_arr = get_field_object('difficulty', $post_id);
            $choices = $category_arr['choices'];
            $value = get_field('difficulty', $post_id);
            if (!empty($value)) {
                echo $choices[$value];

        case 'custom_category' :
            $category_arr = get_field_object('category', $post_id);
            $choices = $category_arr['choices'];
            if (!empty($category_arr) && is_array($category_arr)) {
                $print_str = "";
                foreach ($category_arr['value'] as $value) {
                    $print_str .= $choices[$value] . " ";
                echo $print_str;


add_action('manage_recipe_posts_custom_column', 'custom_recipe_column', 10, 2);

The problem now is, I don't have any pagination. I have 30 items, but the table in the backend only shows the first 8 and there is no pagination at the bottom. When I set the max number of posts shown per page to 999, I still only get 8. What do I have to do, to get the pagination?

  • I have checked the code I think these is no any issue with code. When you remove above code from your file pagination is working for any other post type ? I think issue may be due to some plugin or theme. You can check by change theme to any wordpress default theme and deactive plugins. – Veerji Dec 23 '20 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.