Reset Duplicator Pro capabilities
define( ‘DUPLICATOR_CAPABILITIES_RESET’, true );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
define( ‘DUPLICATOR_CAPABILITIES_RESET’, true );Continue reading
$admin_role = get_role(‘administrator’); $admin_role->add_cap(‘export’, true);Continue reading
// Add action for fetching tool data add_action(‘wp_ajax_fetch_tool_data_unique’, ‘fetch_tool_data_customized’); add_action(‘wp_ajax_nopriv_fetch_tool_data_unique’, ‘fetch_tool_data_customized’); // For non-logged in users if (!function_exists(‘fetch_tool_data_by_task_id_unique’)) { function fetch_tool_data_by_task_id_unique($task_id) { global $wpdb; $task_id = sanitize_text_field($task_id); $table_name = ‘sumaiya_test_table’; // Table name without prefix. $result = $wpdb->get_row( $wpdb->prepare( “SELECT…Continue reading
add_action(‘init’, function () { add_rewrite_rule(‘^oh-dear-health/?$’, ‘index.php?health_check=1’, ‘top’); add_rewrite_tag(‘%health_check%’, ‘1’); }); add_action(‘template_redirect’, function () { if (get_query_var(‘health_check’) == ‘1’) { /* $token = $_GET[‘token’] ?? ”; if ($token !== ‘ma_clé_super_secrète’) { status_header(403); echo json_encode([‘error’ => ‘Unauthorized’]); exit; } */ header(‘Content-Type: application/json’);…Continue reading
function remove_cat_cap_editor () { $role = get_role(‘editor’); $role->remove_cap(‘manage_categories’); // $role->add_cap(‘manage_categories’); } add_action( ‘admin_init’, ‘remove_cat_cap_editor’ );Continue reading
add_action( ‘admin_menu’, function () { $user = wp_get_current_user(); $disallowed_roles = array( ‘administrator’ ); if ( ! array_intersect( $disallowed_roles, $user->roles ) ) { // Stuff here for allowed roles remove_menu_page(‘wp_oopspam_settings_page’); // Below not needed since removed Category capability from Editors //…Continue reading
add_filter( ‘wpml_hreflang_language_for_url’, function( $hreflang, $url, $lang ) { if ( $lang === ‘pt-br’ ) { return [‘pt-br’, ‘pt’]; // Add both pt-br and pt for Brazilian Portuguese } return $hreflang; }, 10, 3 );Continue reading
/** * Output scripts and styles for the favourites button in the head. */ function wwof_output_favourites_scripts() { // Only load on single product pages. if ( ! is_product() ) { return; } // Get current user ID. $user_id = get_current_user_id();…Continue reading
add_filter( ‘woocommerce_product_tabs’, ‘custom_product_meta_fields_tab’ ); function custom_product_meta_fields_tab( $tabs ) { $tabs[‘meta_fields_tab’] = array( ‘title’ => __( ‘Λεπτομέρειες Προϊόντος’, ‘woocommerce’ ), ‘priority’ => 15, ‘callback’ => ‘custom_product_meta_fields_content’ ); return $tabs; } function custom_product_meta_fields_content() { global $post; $systatika = get_post_meta( $post->ID, ‘systatika’, true…Continue reading
/* * Use the shortcode [deliver_to_address] wherever you want the address to appear (e.g., header, sidebar, pages). * Author: Muhammad Mubeen A (wp_expert28) * */ // Shortcode to display “Deliver to:” widget with address edit popup add_shortcode(‘deliver_to_address’, function () {…Continue reading