edit.php all post not working

i am using publish press plugin to create a custom post status i changed the all post status into public, using thisregi

i am using publish press plugin to create a custom post status i changed the all post status into public, using this

register_post_status(
    $status->slug,
    [
        'label'       => $status->name,
        'public'   => true,
        'exclude_from_search'       => true,
        'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,
        '_builtin'    => false,
        'label_count' => _n_noop("{$status->name} <span class='count'>(%s)</span>",
            "{$status->name} <span class='count'>(%s)</span>"),
    ]
);

all post shown at front end but edit.php all post page not working it not showing the all the post which is relevant to custom post type and it also affected the woocommerce

i am using publish press plugin to create a custom post status i changed the all post status into public, using this

register_post_status(
    $status->slug,
    [
        'label'       => $status->name,
        'public'   => true,
        'exclude_from_search'       => true,
        'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,
        '_builtin'    => false,
        'label_count' => _n_noop("{$status->name} <span class='count'>(%s)</span>",
            "{$status->name} <span class='count'>(%s)</span>"),
    ]
);

all post shown at front end but edit.php all post page not working it not showing the all the post which is relevant to custom post type and it also affected the woocommerce

Share Improve this question edited Jun 30, 2019 at 13:54 Jacob Peattie 44.2k10 gold badges50 silver badges64 bronze badges asked Jun 30, 2019 at 13:35 thamarai selvanthamarai selvan 12 bronze badges 3
  • Where did you put this code? Have you defined the $status variable you're using in it anywhere? – Jacob Peattie Commented Jun 30, 2019 at 13:54
  • i just edited at publish press plugin file wp-content/plugins/publishpress/modules/custom-status/custom-status.php – thamarai selvan Commented Jun 30, 2019 at 14:00
  • @JacobPeattie all post status are now show at front end but edit.php file don't shows the all posts eg, edit.php?post_type=shop_order it shows that No orders found – thamarai selvan Commented Jun 30, 2019 at 14:20
Add a comment  | 

1 Answer 1

Reset to default 0

finally found the solution when i enter all the custom post status to public it declare the post_type to default post as global so applied filter to change the global post_type based what type request get in URL


function publishPress_allPost_pre_get_posts( &$wp_query )
{
    if ( is_admin() && array_key_exists( 'post_type', $_GET ) ) {
        $wp_query->set( 'post_type', $_GET['post_type'] );
        add_filter( 'the_posts', 'publishPress_allPost_the_posts', 10, 2 );
    }
}

function publishPress_allPost_the_posts( $posts, &$wp_query )
{
    $wp_query->set( 'post_type', $GLOBALS['post_type'] );
    return $posts;
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745353689a4623992.html

相关推荐

  • edit.php all post not working

    i am using publish press plugin to create a custom post status i changed the all post status into public, using thisregi

    2小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信