Disable Gutenberg Code Editing for Non-Admin Users
add_filter( ‘block_editor_settings_all’, function ( $settings ) { $settings[‘codeEditingEnabled’] = current_user_can( ‘manage_options’ ); return $settings; } );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_filter( ‘block_editor_settings_all’, function ( $settings ) { $settings[‘codeEditingEnabled’] = current_user_can( ‘manage_options’ ); return $settings; } );Continue reading
// Custom PHP Code by Tyler (TITLE) function page_title_sc( ){ return get_the_title(); } add_shortcode( ‘page_title’, ‘page_title_sc’ ); // Enable Shortcode Execution in Text Widgets add_filter( ‘widget_text’, ‘do_shortcode’ ); // Disable Gutenberg Editor (use Classic Editor) add_filter(‘gutenberg_can_edit_post’, ‘__return_false’, 5); add_filter(‘use_block_editor_for_post’, ‘__return_false’,…Continue reading
/* Change WooCommerce Archive products number per page */ add_filter( ‘loop_shop_per_page’, ‘my_new_products_per_page’, 9999 ); function my_new_products_per_page( $pr_per_page ) { $pr_per_page = 16; return $pr_per_page; }Continue reading
add_action( ‘login_footer’, function () { remove_action( ‘login_footer’, ‘wp_shake_js’, 12 ); } );Continue reading
add_filter( ‘comment_form_default_fields’, function ($fields) { if ( isset( $fields[‘url’] ) ) { unset( $fields[‘url’] ); } if ( isset( $fields[‘cookies’] ) ) { // Remove the website mention from the cookies checkbox label. $fields[‘cookies’] = str_replace(‘name, email, and website’, ‘name…Continue reading
// Please edit the address and name below before activating this snippet. // Change the From address. add_filter( ‘wp_mail_from’, function ( $original_email_address ) { return ‘[email protected]’; } ); // Change the From name. add_filter( ‘wp_mail_from_name’, function ( $original_email_from ) {…Continue reading
function wpcode_send_new_user_notifications( $user_id, $notify = ‘user’ ) { if ( empty( $notify ) || ‘admin’ === $notify ) { return; } elseif ( ‘both’ === $notify ) { // Send new users the email but not the admin. $notify =…Continue reading