Duplicate Page/Post/CPT

/** * Duplicate WordPress Posts, Pages, and Custom Post Types as Drafts * * This code snippet enables the duplication of WordPress posts, pages, and all registered custom post types (CPTs). * It adds a ‘Duplicate’ link to the row…Continue reading

Duplicate Page/Post/CPT

/** * Duplicate WordPress Posts, Pages, and Custom Post Types as Drafts * * This code snippet enables the duplication of WordPress posts, pages, and all registered custom post types (CPTs). * It adds a ‘Duplicate’ link to the row…Continue reading

Admin Color Scheme

add_filter(“get_user_option_admin_color”, “update_user_option_admin_color”, 5); function update_user_option_admin_color($color_scheme) { $color_scheme = “modern”; // Options are: // fresh // light // blue // coffee // ectoplasm // midnight // modern // ocean // sunrise return $color_scheme; }Continue reading

Custom Sections Dashboard Menu

function customSections_admin_menu() { add_menu_page( ”, // Page Title ‘Custom Sections’, // Menu Title ‘manage_options’, // Capabiliy required to see the menu ‘#’, // Menu_slug – # kills the link so we don’t end up somewhere strange since this is just…Continue reading

Custom Image Sizes

// Register the new image sizes in WordPress add_theme_support( ‘post-thumbnails’ ); add_image_size( ‘image-480’, 480, 9999 ); add_image_size( ‘image-720’, 720, 9999 ); add_image_size( ‘image-1440’, 1440, 9999 ); add_image_size( ‘image-1920’, 1920, 9999 ); // Include the new image sizes in the Add…Continue reading

Create Site Admin Role and Remove Other Roles

// Remove roles // https://wpmudev.com/blog/wordpress-delete-user-roles/ // Keep Subscriber so we have a default for new logins // Keep Editor so we have it to clone for Site Admin below $wp_roles = new WP_Roles(); $wp_roles->remove_role(“contributor”); $wp_roles->remove_role(“author”); add_action(‘init’, ‘cloneRole’); function cloneRole() {…Continue reading

Change Schema Type of All Posts in Specific Categories

add_filter(‘aioseo_schema_output’, ‘change_schema_type_in_specific_categories’); function change_schema_type_in_specific_categories($schema) { // Specify the category slugs you want to target $target_category_slugs = array(‘category1-slug’, ‘category2-slug’, ‘category3-slug’); foreach ($schema as &$schemaItem) { // Check if the post belongs to any of the specified categories if (isset($schemaItem[‘@type’]) && ‘NewsArticle’…Continue reading