admin管理员组文章数量:1277405
At first sorry for my bad English! I try to hide #mceu_27-body and #wp-content-editor-tools on products page (editing mode) like on the pics for certains authors! This work find :
add_action('admin_head', 'wwc_my_custom_css');
if (!current_user_can('edit_pages') ) {
function wwc_my_custom_css() {
echo '<style>
#mceu_27-body, #wp-content-editor-tools{
display:none !important;
}
</style>';}
}
But it affect all posts type and I just want it on products post type so I tried that but it doesn't work :
add_action('admin_head', 'wwc_my_custom_css');
if (!current_user_can('edit_pages') && is_product() )
function wwc_my_custom_css() {
echo '<style>
#mceu_27-body, #wp-content-editor-tools{
display:none !important;
}
</style>';}
}
Thx
At first sorry for my bad English! I try to hide #mceu_27-body and #wp-content-editor-tools on products page (editing mode) like on the pics for certains authors! This work find :
add_action('admin_head', 'wwc_my_custom_css');
if (!current_user_can('edit_pages') ) {
function wwc_my_custom_css() {
echo '<style>
#mceu_27-body, #wp-content-editor-tools{
display:none !important;
}
</style>';}
}
But it affect all posts type and I just want it on products post type so I tried that but it doesn't work :
add_action('admin_head', 'wwc_my_custom_css');
if (!current_user_can('edit_pages') && is_product() )
function wwc_my_custom_css() {
echo '<style>
#mceu_27-body, #wp-content-editor-tools{
display:none !important;
}
</style>';}
}
Thx
Share Improve this question edited Nov 12, 2021 at 22:40 vancoder 7,92428 silver badges35 bronze badges asked Nov 11, 2021 at 20:23 Fanto masFanto mas 11 bronze badge1 Answer
Reset to default 0I assume you mean to use this on a single product's page, right? If so, try this:
add_action('admin_head', 'wwc_my_custom_css');
function wwc_my_custom_css() {
if (!current_user_can('edit_pages'){
global $post;
$isProduct = $post->post_type == 'product'; // use the actual name for product
if ($isProduct ) {
echo '<style>
#mceu_27-body, #wp-content-editor-tools{
display:none !important;
}
</style>';
}
}
}
本文标签: postsTarget only single product page
版权声明:本文标题:posts - Target only single product page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741222692a2361269.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论