Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 73026

Can Somebody be modified this codes for woocommerce ?

$
0
0

Replies: 0

Hi,
I want to limit vendors publish product.
I find codes for author to publish post? ,
can Anybody modified for woocommerce products ?

The post codes

add_action(“load-post-new.php”,”limit_user_by_post_count”);
function limit_user_by_post_count(){
$user = get_current_user_id();
if (!current_user_can( ‘manage_options’)) {
//not an admin – so impose the limit
$user_post_count = count_user_posts($user);
if($user_post_count>=10)
header(“Location: /wp-admin/edit.php”);
}
}

Thank you so much. I hope anybody help me.
Have a nice day !


Viewing all articles
Browse latest Browse all 73026

Trending Articles