Hot answers tagged

2

You need the !is_admin() check. This will return false on admin pages, failing your condition. On front end pages, that condition will return true, executing your conditional statement if ( !is_admin() ) { // Do something only on frontend }


2

If you change manage_edit-post_columns to manage_posts_columns in your code snippet, then it should hide the comment column for all post types (appart from the page post type) within the WP_Posts_List_Table src. You might want to check if the column array key isset first, before unsetting it.


2

I got an alternative : This will not just hiding but disabling also function disable_comments() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type,'comments')) { remove_post_type_support($post_type,'comments'); remove_post_type_support($post_type,'trackbacks'); ...


2

Here's one demo suggestion: add_action( 'admin_enqueue_scripts', function() { wp_enqueue_script( 'my-script', '/my-script.js', ['underscore', 'backbone'], '1.0' ); wp_add_inline_script( 'my-script', 'alert("hello world");' ); // Add our template if( function_exists( 'wpse_add_inline_tmpl' ) ) wpse_add_inline_tmpl( $handle =...


1

First of all I am a careful (maybe paranoid) guy. I tried to login into a Wordpress account few days ago and didnĀ“t noticed it was the "Admin" login. I even notice that I can login via Twitch ... but that was too late! If it's not your account you should notify them! If you can get in who else might be in there doing bad things? Back to my story. If I ...



Only top voted, non community-wiki answers of a minimum length are eligible