How to delete default themes

My approach is to delete the default themes using ftp or your control panel file-manager once you have your site up and running. These themes will not be re-installed when you update WordPress, and will not show up in your update notifications. I usually keep the TwentySixteen theme on the system as this is the … Read more

how to extend a WP_widget twice

You have to make sure that all of your parameters are passed all the way through to the WP_Widget class. Your code is very truncated but I am pretty sure that is what you are doing wrong. The widget code below works– it doesn’t do much of anything, but it works. See if you can … Read more

How to change in customizer the “site identity” tab required capabilities

This is how I’ve interpreted from the wordpress docs at least. Originally these settings were made with add_setting and it is where the capability was originally set. Fortunately, we can use get_setting to change that value. It seems to work very well for your case. function wpseo_206907_add_back_customizer_controls_for_not_admins( $wp_customize ) { $wp_customize->get_setting( ‘blogname’ )->capability = ‘edit_theme_options’; … Read more

Limit comments displayed on basis of user_id

The pre_get_comments hook Note that the single post’s comments are fetched with get_comments(), within the comment_template() function. The get_comments() function is just a WP_Comment_Query object wrapper, so we can restrict the comment query with the pre_get_comments hook. Example #1 Here’s a simple user_id restriction example: ! is_admin() && add_action( ‘pre_get_comments’, function( \WP_Comment_Query $q ) { … Read more

How to set value/term of a Woocommerce attribute text field in admin panel?

I am assuming the ID of that text filed, is url-field here is the JS code $(“#url-field”).keyup(function(event) { var url_val=$(“#url-field”).val(); $.ajax({ type:”POST”, url: ajaxurl, data: { action:’use_someprefix_update_url’, search_string:url_val, namefiled : namehere, postid : postidhereYouCangetItIHope }, success:function(data){ alert(“Success, you can remove me 🙂 “); } }); }); Here comes PHP, put this in functions.php function use_someprefix_update_url(){ … Read more

Adding an email column to a Custom Post Types Admin Screen?

May be you can try this: add_filter(‘manage_edit-movie_columns’, ‘custom_add_new_columns’); function custom_add_new_columns( $columns ){ $columns[‘author_email’] = ‘Email’; return $columns; } add_action(‘manage_movie_posts_custom_column’, ‘custom_manage_new_columns’, 10, 2); function custom_manage_new_columns( $column_name, $id ){ if (‘author_email’==$column_name){ $current_item = get_post($id); $author_id = $current_item->post_author; $author_email = get_the_author_meta( ‘user_email’, $author_id); echo ‘<a href=”https://wordpress.stackexchange.com/questions/158706/mailto:”.$author_email.'”>’.$author_email.'</a>’; } } Here, I have used custom post type movie. You need … Read more