Add Icon to the Left Side of the Order Number (Admin Order Page)

function g9_user_role_order_icon($column_name, $post_id) { if ($column_name == ‘order_number’) { $order = wc_get_order($post_id); // Get user id from order $user_id = $order->get_user_id(); if ($user_id > 0) { $user_meta = get_userdata($user_id); $user_roles = $user_meta->roles; // Check if user role my-custom-user-role is in…Continue reading

WPForms: hide certain sections on a single entry page: notes, log, debug, meta, payment, actions, related, geolocation.

// Main content area. add_action( ‘wpforms_entry_details_content’, static function ( $entry, $form_data, $single_entry ) { $hook_name = ‘wpforms_entry_details_content’; remove_action( $hook_name, [ $single_entry, ‘details_fields’ ], 10 ); remove_action( $hook_name, [ $single_entry, ‘details_notes’ ], 10 ); remove_action( $hook_name, [ $single_entry, ‘details_log’ ], 40…Continue reading

Populate ACF Field with Post Types

function acf_load_post_types_populate_field( $field ) { // reset choices $field[‘choices’] = array(); // Get post types $args = array( ‘public’ => true, ); $post_types = get_post_types( $args, ‘objects’ ); unset( $post_types[‘attachment’] ); foreach ( $post_types as $post_type ) { $value =…Continue reading

Filter Code to increase SEO Analyzer timeout

add_filter( ‘http_request_args’, ‘aioseo_filter_analyzer_timeout’, 1, 2 ); function aioseo_filter_analyzer_timeout( $args, $url ) { if ( ‘https://analyze.aioseo.com/v1/analyze/’ === $url ) { $args[‘timeout’] = 120; } return $args; }Continue reading

Admin Panel Footer – Menu

add_filter( ‘admin_footer_text’, function ( $footer_text ) { // Edit the line below to customize the footer text. $footer_text = ‘Check Scorecard | Get Kallados | Check GT Speed | Check Goog Speed | Update CSP | Login CDN‘; return $footer_text;…Continue reading

Admin Bar – Updates

function add_updates_admin_bar_menu() { global $wp_admin_bar; $wp_admin_bar->add_menu( array( ‘id’ => ‘updates’, ‘title’ => ‘Updates’, ‘href’ => admin_url( ‘update-core.php’ ), ‘parent’ => ‘top-secondary’, ) ); } add_action( ‘wp_before_admin_bar_render’, ‘add_updates_admin_bar_menu’ );Continue reading

Setting default template for post type

/** * Setting default template for post type as a pattern php file * */ function awesome_register_podcast_template() { $post_type_object = get_post_type_object( ‘podcast’ ); $post_type_object->template = array( array( ‘core/pattern’, array( ‘slug’ => ‘vivek/podcast-audio’, ) ), ); } add_action( ‘init’, ‘awesome_register_podcast_template’ );Continue reading

Loading ACF Blocks from theme

/** * Load Blocks */ function load_blocks() { $theme = wp_get_theme(); $blocks = get_blocks(); foreach( $blocks as $block ) { if ( file_exists( get_template_directory() . ‘/blocks/’ . $block . ‘/block.json’ ) ) { register_block_type( get_template_directory() . ‘/blocks/’ . $block .…Continue reading