Replace Hi Greeting AND Comma

// Replace Hi Greeting AND Comma function replace_hi_greeting($wp_admin_bar) { $my_account=$wp_admin_bar->get_node(‘my-account’); $newtitle = str_replace(‘Hi,’, ”, $my_account->title ); $wp_admin_bar->add_node(array( ‘id’ => ‘my-account’, ‘title’ => $newtitle, ) ); } add_filter(‘admin_bar_menu’, ‘replace_hi_greeting’,12);Continue reading

Remove author column in pages

/* Remove author column in pages */ function custom_remove_author_column( $columns ) { unset($columns[‘author’]); // Remove the author column return $columns; } add_filter( ‘manage_pages_columns’ , ‘custom_remove_author_column’ );Continue reading

Rubber Duckers maintenance menu

// Custom links in Admin bar add_action(‘admin_bar_menu’, ‘add_toolbar_items’, 60); function add_toolbar_items($admin_bar){ $admin_bar->add_menu( array( ‘id’ => ‘Rubber Duckers’, ‘title’ => ‘Rubber Duckers’, ‘href’ => ‘#’, ‘meta’ => array( ‘title’ => __(‘Rubber Duckers’), ), )); $admin_bar->add_menu( array( ‘id’ => ‘Website’, ‘parent’ =>…Continue reading

Add file to media library programmatically

$file = ‘/path/to/file.png’; $filename = basename($file); $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); if (!$upload_file[‘error’]) { $wp_filetype = wp_check_filetype($filename, null ); $attachment = array( ‘post_mime_type’ => $wp_filetype[‘type’], ‘post_parent’ => $parent_post_id, ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, $filename), ‘post_content’ => ”, ‘post_status’ => ‘inherit’ );…Continue reading

Remove plugin deactivation

// Remove plugin deactivation function rubberduckers_disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) { if ( array_key_exists( ‘deactivate’, $actions ) && in_array( $plugin_file, array( ‘advanced-custom-fields-pro/acf.php’, ‘perfmatters/perfmatters.php’, ‘termageddon-usercentrics/termageddon-usercentrics.php’, ‘patchstack/patchstack.php’, ‘admin-menu-editor-pro/menu-editor.php’, ‘flying-press/flying-press.php’, ‘wpcode-premium/wpcode.php’ ))) unset( $actions[‘deactivate’] ); return $actions; } add_filter( ‘plugin_action_links’, ‘rubberduckers_disable_plugin_deactivation’, 10,…Continue reading

Duplicate Post/Page Link

// Add duplicate button to post/page list of actions. add_filter( ‘post_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); add_filter( ‘page_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); // Let’s make sure the function doesn’t already exist. if ( ! function_exists( ‘wpcode_snippet_duplicate_post_link’ ) ) { /** *…Continue reading

PHP [Profile Builder]: Bidirectional Save

// This code snippet is intended to run directly after ACF form data has been saved to the database // AND the updated post is the post type ‘vendor’ // // Information from the ‘vendor’ post (Post Content, Post Taxonomy,…Continue reading

Rename Posts to Policies

add_action( ‘init’, ‘cp_change_post_object’ ); // Change dashboard Posts to Policies function cp_change_post_object() { $get_post_type = get_post_type_object(‘post’); $labels = $get_post_type->labels; $labels->name = ‘Policies’; $labels->singular_name = ‘Policy’; $labels->add_new = ‘Add Policy’; $labels->add_new_item = ‘Add Policy’; $labels->edit_item = ‘Edit Policy’; $labels->new_item = ‘Policies’;…Continue reading

Cornerstone & Perfmatters fix

add_filter( ‘x_enqueue_parent_stylesheet’, ‘__return_true’ ); /* Perfmatters Cornerstone fix */ if(strpos($_SERVER[‘REQUEST_URI’], ‘/cornerstone/’) || isset($_POST[‘cs_preview_state’])) { add_filter(‘perfmatters_allow_buffer’, ‘__return_false’); }Continue reading

Content Search

add_action(‘admin_menu’, ‘content_search_add_admin_menu’); add_action(‘admin_head’, ‘content_search_custom_styles’); function content_search_add_admin_menu() { add_menu_page( ‘Content Search’, ‘Content Search’, ‘manage_options’, ‘content-search’, ‘content_search_page’, ‘dashicons-search’, 6 ); } function content_search_custom_styles() { ?> Content Search The Content Search feature enables you to find specific text within your WordPress site’s content.…Continue reading