Current Year
function current_year_shortcode() { return date(‘Y’); } add_shortcode(‘year’, ‘current_year_shortcode’);Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
function current_year_shortcode() { return date(‘Y’); } add_shortcode(‘year’, ‘current_year_shortcode’);Continue reading
add_filter(‘gutenberg_can_edit_post’, ‘__return_false’, 5); add_filter(‘use_block_editor_for_post’, ‘__return_false’, 5);Continue reading
/** * Disable the emojis in WordPress. */ add_action( ‘init’, function () { remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 ); remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ ); remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ ); remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ ); remove_filter( ‘the_content_feed’, ‘wp_staticize_emoji’ ); remove_filter( ‘comment_text_rss’, ‘wp_staticize_emoji’ ); remove_filter( ‘wp_mail’,…Continue reading
add_filter(‘the_generator’, ‘__return_empty_string’);Continue reading
/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading
if (!function_exists(‘rk_keep_me_logged_in’)) { function rk_keep_me_logged_in($expirein) { return 31556926; // 1 year in seconds } } add_filter(‘auth_cookie_expiration’,’rk_keep_me_logged_in’);Continue reading
// Add custom Bulk Action to the Pages view function custom_add_bulk_action() { global $post_type; if ($post_type == ‘page’) { ?>Continue reading
// Display custom field on single product page function d_extra_product_field(){ $value = isset( $_POST[‘extra_product_field’] ) ? sanitize_text_field( $_POST[‘extra_product_field’] ) : ”; printf( ‘ %s ‘, __( ‘Customisation note:’ ), esc_attr( $value ) ); } add_action( ‘woocommerce_after_add_to_cart_button’, ‘d_extra_product_field’, 9 ); //…Continue reading
function et_add_viewport_meta(){ echo ‘‘; }Continue reading