简体   繁体   English

从管理员端删除Wordpress插件功能

[英]Remove Wordpress Plugin functionality from admin side

I'm using a WordPress plugin https://github.com/lesterchan/wp-postratings . 我正在使用WordPress插件https://github.com/lesterchan/wp-postratings It also showing ratings on admin, when i visit http://domain.com/wp-admin/edit.php . 当我访问http://domain.com/wp-admin/edit.php时,它还会在admin上显示评级。 在此处输入图片说明 How do i remove those ratings from admin side. 我如何从管理员端删除这些评分。

You can use the below function in your functions.php file with the manage_posts_columns filter. 您可以在manage.posts_columns过滤器的functions.php文件中使用以下函数。 I'm assuming your custom post type id 'tools' and the column is referenced by 'ratings'. 我假设您的自定义帖子类型ID为“工具”,并且该列由“评分”引用。 If they are different you can just change that in the code. 如果它们不同,则可以在代码中进行更改。

add_filter( 'manage_posts_columns', 'custom_post_columns', 10, 2 );
function custom_post_columns( $columns, $post_type ) {

  switch ( $post_type ) {    

    //assuming the id for the custom post type is 'tools'
    case 'tools':
    unset(
      //I'm using 'ratings' but you'll have to check and see what the name for the column really is.
      $columns['ratings']
    );
    break;

  }

  return $columns;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM