Action Scheduler Retention Period
add_filter( ‘action_scheduler_retention_period’, function () { return WEEK_IN_SECONDS; } );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_filter( ‘action_scheduler_retention_period’, function () { return WEEK_IN_SECONDS; } );Continue reading
function display_logged_in_firstname() { if (is_user_logged_in()) { $current_user = wp_get_current_user(); $first_name = $current_user->first_name ? $current_user->first_name : ‘there’; return “Hi {$first_name},”; } else { return “Hi there,”; } } add_shortcode(‘user_firstname’, ‘display_logged_in_firstname’);Continue reading
// Leo is Amazing // Add custom row actions add_filter(‘post_row_actions’, ‘add_custom_row_actions’, 10, 2); add_filter(‘page_row_actions’, ‘add_custom_row_actions’, 10, 2); function add_custom_row_actions($actions, $post) { if (current_user_can(‘delete_posts’)) { $url = wp_nonce_url(admin_url(“admin-post.php?action=permanent_delete_post&post=” . $post->ID), ‘permanent_delete_post_’ . $post->ID); $actions[‘permanent_delete’] = ‘Permanently Delete‘; } if ($post->post_status ==…Continue reading
function create_consultant_logs_entry($log_content) { // Check if Pods is active if (!function_exists(‘pods’)) { error_log(‘Pods is not active.’); return false; } $logs_pod_name = ‘logs’; // The name of the Pod $log_entry_field = ‘log’; // The field in the Pod to store the…Continue reading
function create_consultant_logs_entry($log_content) { // Check if Pods is active if (!function_exists(‘pods’)) { error_log(‘Pods is not active.’); return false; } $logs_pod_name = ‘logs’; // The name of the Pod $log_entry_field = ‘log’; // The field in the Pod to store the…Continue reading
function create_consultant_logs_entry($log_content) { // Check if Pods is active if (!function_exists(‘pods’)) { error_log(‘Pods is not active.’); return false; } $logs_pod_name = ‘logs’; // The name of the Pod $log_entry_field = ‘log’; // The field in the Pod to store the…Continue reading
// Redirect all users to a specific page after login from a specific login page function custom_mepr_login_redirect_url($url, $user) { // Check the referrer to see if the login request came from a specific page if (isset($_SERVER[‘HTTP_REFERER’])) { $referrer = $_SERVER[‘HTTP_REFERER’];…Continue reading
// Redirect users after login based on their roles function custom_mepr_login_redirect_url($url, $user) { // Check if the user object is valid if (isset($user->roles) && is_array($user->roles)) { // Roles that should be redirected to the WordPress dashboard $admin_roles = array(‘administrator’, ‘editor’,…Continue reading
// Redirect users after login based on their roles function custom_mepr_login_redirect_url($url, $user) { // Check if the user object is valid if (isset($user->roles) && is_array($user->roles)) { // Roles that should be redirected to the WordPress dashboard $admin_roles = array(‘administrator’, ‘editor’,…Continue reading