// Check if page is the home page, if yes, then dequeue identified scripts. Improve load time. function check_page_id() { // Get the current page ID global $post; $the_post_type = $post->post_type; $page_id = get_queried_object_id(); // Check if the page ID…Continue reading
// Remove plugin from client view to prevent potential issues if settings are changed. function idxc_hide_plugin() { if (is_admin()) { $current_user = wp_get_current_user(); // If the current user’s username is not “idxcentral”, hide the plugin if (‘idxcentral’ !== $current_user->user_login) {…Continue reading
add_action(‘save_post’, function($post_id, $post, $update) { // Check if it’s a page if ($post->post_type !== ‘page’) { return; } // Check if the page has a parent $parent_id = $post->post_parent; // If it doesn’t have a parent, exit if (!$parent_id) {…Continue reading
/* Get Statuscode 404 for existing & non-existing author archives. */ add_action( ‘template_redirect’, function() { if ( isset( $_GET[‘author’] ) || is_author() ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } }, 1 ); /* Remove the Author Links…Continue reading
// Change OG title for Rank Math on Vendor Pages function wcv_rankmath_change_og_title( $title ) { WC_Vendors::log( $title ); if ( WCV_Vendors::is_vendor_page() ) { $vendor_shop = urldecode( get_query_var( ‘vendor_shop’ ) ); $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); $shop_title = get_user_meta( $vendor_id, ‘pv_shop_name’,…Continue reading
// Change OG title for Yoast on Vendor Pages function wcv_wpseo_change_og_title( $title ) { if ( WCV_Vendors::is_vendor_page() ) { $vendor_shop = urldecode( get_query_var( ‘vendor_shop’ ) ); $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); $shop_title = get_user_meta( $vendor_id, ‘pv_shop_name’, true ); $og_title =…Continue reading
/* * Make Private Posts visible to Subscribers * Typically only visible to admin or editor */Continue reading
add_action( ‘admin_footer’, function() { if ( $GLOBALS[‘current_screen’]->base !== ‘post’ ) { return; } ?>Continue reading
// // Add custom columns to post and page lists function custom_add_id_columns($columns) { $columns[‘post_id’] = ‘ID’; // For Posts $columns[‘page_id’] = ‘ID’; // For Pages return $columns; } add_filter(‘manage_posts_columns’, ‘custom_add_id_columns’); add_filter(‘manage_pages_columns’, ‘custom_add_id_columns’); // Populate the custom columns with IDs function…Continue reading
function exclude_pages_from_search($query) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); // Exclude pages by changing ‘post’ to ‘page’ } return $query; } add_filter(‘pre_get_posts’,’exclude_pages_from_search’);Continue reading