',\r\n\t\t\t'<\/a>'\r\n\t\t)\r\n\t);\r\n}\r\n\r\n\/\/ Replace all feeds with the message above.\r\nadd_action( 'do_feed_rdf', 'wpcode_snippet_disable_feed', 1 );\r\nadd_action( 'do_feed_rss', 'wpcode_snippet_disable_feed', 1 );\r\nadd_action( 'do_feed_rss2', 'wpcode_snippet_disable_feed', 1 );\r\nadd_action( 'do_feed_atom', 'wpcode_snippet_disable_feed', 1 );\r\nadd_action( 'do_feed_rss2_comments', 'wpcode_snippet_disable_feed', 1 );\r\nadd_action( 'do_feed_atom_comments', 'wpcode_snippet_disable_feed', 1 );\r\n\/\/ Remove links to feed from the header.\r\nremove_action( 'wp_head', 'feed_links_extra', 3 );\r\nremove_action( 'wp_head', 'feed_links', 2 );\r\n","note":"Turn off the WordPress RSS Feeds for your website with 1 click.","categories":["rss-feeds"],"code_type":"php","needs_auth":""},{"library_id":47,"title":"Disable Search","code":"\/\/ Prevent search queries.\r\nadd_action(\r\n\t'parse_query',\r\n\tfunction ( $query, $error = true ) {\r\n\t\tif ( is_search() && ! is_admin() ) {\r\n\t\t\t$query->is_search = false;\r\n\t\t\t$query->query_vars['s'] = false;\r\n\t\t\t$query->query['s'] = false;\r\n\t\t\tif ( true === $error ) {\r\n\t\t\t\t$query->is_404 = true;\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t15,\r\n\t2\r\n);\r\n\r\n\/\/ Remove the Search Widget.\r\nadd_action(\r\n\t'widgets_init',\r\n\tfunction () {\r\n\t\tunregister_widget( 'WP_Widget_Search' );\r\n\t}\r\n);\r\n\r\n\/\/ Remove the search form.\r\nadd_filter( 'get_search_form', '__return_empty_string', 999 );\r\n\r\n\/\/ Remove the core search block.\r\nadd_action(\r\n\t'init',\r\n\tfunction () {\r\n\t\tif ( ! function_exists( 'unregister_block_type' ) || ! class_exists( 'WP_Block_Type_Registry' ) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$block = 'core\/search';\r\n\t\tif ( WP_Block_Type_Registry::get_instance()->is_registered( $block ) ) {\r\n\t\t\tunregister_block_type( $block );\r\n\t\t}\r\n\t}\r\n);\r\n\r\n\/\/ Remove admin bar menu search box.\r\nadd_action(\r\n\t'admin_bar_menu',\r\n\tfunction ( $wp_admin_bar ) {\r\n\t\t$wp_admin_bar->remove_menu( 'search' );\r\n\t},\r\n\t11\r\n);\r\n","note":"Completely disable search on your WordPress website.","categories":["disable"],"code_type":"php","needs_auth":""},{"library_id":955,"title":"Disable Self Pingbacks","code":"","note":"Prevent WordPress from automatically creating pingbacks from your own site.","categories":["disable"],"code_type":"php","needs_auth":"1"},{"library_id":13595,"title":"Disable Site Admin Email Verification","code":"","note":"Stop WordPress from asking you to confirm the administrator email address when logging in.","categories":["admin"],"code_type":"php","needs_auth":"1"},{"library_id":6006,"title":"Disable Site Health","code":"","note":"Completely hide the Site Health menu item and dashboard widget.","categories":["admin","disable"],"code_type":"php","needs_auth":"1"},{"library_id":15142,"title":"Disable the Excerpt in RSS Feeds","code":"","note":"Hide the excerpt or content from your RSS feeds.","categories":["rss-feeds"],"code_type":"php","needs_auth":"1"},{"library_id":6566,"title":"Disable the WordPress Shortlink","code":"","note":"Remove link rel shortlink from your site head area.","categories":["archive","disable"],"code_type":"php","needs_auth":"1"},{"library_id":42,"title":"Disable The WP Admin Bar","code":"\/* Disable WordPress Admin Bar for all users *\/\r\nadd_filter( 'show_admin_bar', '__return_false' );","note":"Hide the WordPress Admin Bar for all users in the frontend.","categories":["most-popular","admin"],"code_type":"php","needs_auth":""},{"library_id":13029,"title":"Disable Update Notice for Non-admin Users","code":"","note":"Don't show WordPress version update notices to users that can't update the site.","categories":["admin","disable"],"code_type":"php","needs_auth":"1"},{"library_id":35,"title":"Disable Widget Blocks (use Classic Widgets)","code":"add_filter( 'use_widgets_block_editor', '__return_false' );","note":"Use the classic interface instead of Blocks to manage Widgets.","categories":["most-popular","widgets"],"code_type":"php","needs_auth":""},{"library_id":953,"title":"Disable wlwmanifest link","code":"","note":"Prevent WordPress from adding the Windows Live Writer manifest link to your pages.","categories":["disable"],"code_type":"php","needs_auth":"1"},{"library_id":37,"title":"Disable WordPress REST API","code":"add_filter(\r\n\t'rest_authentication_errors',\r\n\tfunction ( $access ) {\r\n\t\treturn new WP_Error(\r\n\t\t\t'rest_disabled',\r\n\t\t\t__( 'The WordPress REST API has been disabled.' ),\r\n\t\t\tarray(\r\n\t\t\t\t'status' => rest_authorization_required_code(),\r\n\t\t\t)\r\n\t\t);\r\n\t}\r\n);","note":"Easily disable the WP REST API on your website with this snippet.","categories":["most-popular","disable"],"code_type":"php","needs_auth":""},{"library_id":6009,"title":"Disable WordPress Sitemaps","code":"","note":"Disable the auto-generated WordPress Sitemaps added in version 5.5.","categories":["disable"],"code_type":"php","needs_auth":"1"},{"library_id":55,"title":"Disable XML-RPC","code":"add_filter( 'xmlrpc_enabled', '__return_false' );\r\n","note":"On sites running WordPress 3.5+, disable XML-RPC completely.","categories":["most-popular","disable"],"code_type":"php","needs_auth":""},{"library_id":16242,"title":"Display Reading Time","code":"","note":"Add the estimated reading time before the post content.","categories":["archive"],"code_type":"php","needs_auth":"1"},{"library_id":62,"title":"Display the Last Updated Date","code":"$u_time = get_the_time( 'U' );\r\n$u_modified_time = get_the_modified_time( 'U' );\r\n\/\/ Only display modified date if 24hrs have passed since the post was published.\r\nif ( $u_modified_time >= $u_time + 86400 ) {\r\n\r\n\t$updated_date = get_the_modified_time( 'F jS, Y' );\r\n\t$updated_time = get_the_modified_time( 'h:i a' );\r\n\r\n\t$updated = '';\r\n\r\n\t$updated .= sprintf(\r\n\t\/\/ Translators: Placeholders get replaced with the date and time when the post was modified.\r\n\t\tesc_html__( 'Last updated on %1$s at %2$s' ),\r\n\t\t$updated_date,\r\n\t\t$updated_time\r\n\t);\r\n\t$updated .= '<\/p>';\r\n\r\n\techo wp_kses_post( $updated );\r\n}\r\n","note":"Add the last updated date & time to your posts in the frontend.","categories":["archive"],"code_type":"php","needs_auth":""},{"library_id":1196,"title":"Duplicate Post\/Page Link","code":"","note":"Duplicate posts, pages or any post type with 1-click by adding a duplicate link in...","categories":["most-popular","admin"],"code_type":"php","needs_auth":"1"},{"library_id":6002,"title":"Dynamic Year Copyright Shortcode","code":"","note":"This snippet adds an easy-to-use shortcode to display the copyright symbol with the current year.","categories":["archive"],"code_type":"php","needs_auth":"1"},{"library_id":6013,"title":"Empty Admin Dashboard","code":"","note":"Disable all dashboard widgets in the admin and the welcome panel.","categories":["admin","disable"],"code_type":"php","needs_auth":"1"},{"library_id":53,"title":"Enable Shortcode Execution in Text Widgets","code":"add_filter( 'widget_text', 'do_shortcode' );","note":"Extend the default Text Widget with shortcode execution.","categories":["widgets"],"code_type":"php","needs_auth":""},{"library_id":4152,"title":"Enable Shortcode Execution in WPCode HTML Snippets","code":"","note":"Use this snippet to enable shortcode execution in WPCode HTML snippets.","categories":["archive"],"code_type":"php","needs_auth":"1"},{"library_id":52,"title":"Exclude Specific Categories from RSS Feed","code":"\/**\r\n * Exclude a category or multiple categories from the feeds.\r\n * If you want to exclude multiple categories, use a comma-separated list: \"-15, -5, -6\".\r\n * Make sure to prefix the category id(s) with a minus \"-\".\r\n *\r\n * @param WP_Query $query The query.\r\n *\/\r\nfunction wpcode_snippets_exclude_feed_category( $query ) {\r\n\tif ( $query->is_feed ) {\r\n\t\t\/\/ Replace 15 with the desired category id you want to exclude.\r\n\t\t$query->set( 'cat', '-15' );\r\n\t}\r\n}\r\n\r\nadd_action( 'pre_get_posts', 'wpcode_snippets_exclude_feed_category' );\r\n","note":"Prevent posts in certain categories from showing up in your RSS Feeds.","categories":["rss-feeds"],"code_type":"php","needs_auth":""},{"library_id":15139,"title":"Extend Login Expiration Time","code":"","note":"Toggling \"Remember Me\" will keep you logged-in for 30 days instead of 14 days.","categories":["login"],"code_type":"php","needs_auth":"1"},{"library_id":19,"title":"Hide \u2018Screen Options\u2019 Tab","code":"\/\/ Hide admin 'Screen Options' tab\r\nadd_filter('screen_options_show_screen', '__return_false');","note":"Remove the Screen Options menu at the top of admin pages.","categories":["admin"],"code_type":"php","needs_auth":""},{"library_id":45,"title":"Hide Login Errors in WordPress","code":"add_filter(\r\n\t'login_errors',\r\n\tfunction ( $error ) {\r\n\t\t\/\/ Edit the line below to customize the message.\r\n\t\treturn 'Something is wrong!';\r\n\t}\r\n);\r\n","note":"Improve safety by hiding the specific login error information.","categories":["login"],"code_type":"php","needs_auth":""},{"library_id":6570,"title":"Limit the Number of Post Revisions","code":"","note":"Reduce Database size by limiting post revisions to just 20 per post.","categories":["admin"],"code_type":"php","needs_auth":"1"},{"library_id":957,"title":"Lowercase Filenames for Uploads","code":"","note":"Make all the filenames of new uploads to lowercase after you enable this snippet.","categories":["attachments"],"code_type":"php","needs_auth":"1"},{"library_id":13583,"title":"Move Admin Bar to the Bottom","code":"","note":"Move the admin bar to the bottom of the screen in the frontend.","categories":["admin"],"code_type":"css","needs_auth":"1"},{"library_id":16235,"title":"Post Meta Debugger","code":"","note":"Add a metabox that lists all the custom fields\/meta values for a post\/page for easy...","categories":["admin"],"code_type":"php","needs_auth":"1"},{"library_id":16238,"title":"Remove Color Scheme Picker","code":"","note":"Disable the option to change the admin color scheme in the profile page.","categories":["admin","disable"],"code_type":"php","needs_auth":"1"},{"library_id":51,"title":"Remove Dashboard Welcome Panel","code":"add_action(\r\n\t'admin_init',\r\n\tfunction () {\r\n\t\tremove_action( 'welcome_panel', 'wp_welcome_panel' );\r\n\t}\r\n);\r\n","note":"Hide the Welcome Panel on the WordPress dashboard for all users.","categories":["admin"],"code_type":"php","needs_auth":""},{"library_id":969,"title":"Remove Login Shake Animation","code":"","note":"Prevent the Login box from shaking when entering the wrong password or username.","categories":["disable","login"],"code_type":"php","needs_auth":"1"},{"library_id":950,"title":"Remove Query Strings From Static Files","code":"","note":"Use this snippet to remove query string from CSS & JS files and improve performance...","categories":["attachments","disable"],"code_type":"php","needs_auth":"1"},{"library_id":13031,"title":"Remove the WordPress Logo From the Admin Bar","code":"","note":"Hide the WordPress logo in the admin bar for all users.","categories":["disable"],"code_type":"php","needs_auth":"1"},{"library_id":36,"title":"Remove WordPress Version Number","code":"add_filter('the_generator', '__return_empty_string');\r\n","note":"Hide the WordPress version number from your site's frontend and feeds.","categories":["most-popular","disable"],"code_type":"php","needs_auth":""},{"library_id":13590,"title":"Remove WP Block Library CSS","code":"","note":"Stop WordPress from loading the block editor CSS - especially useful if you don't use...","categories":["disable"],"code_type":"php","needs_auth":"1"},{"library_id":959,"title":"Replace WordPress Logo on Login Page","code":"","note":"Use your custom logo on the default login page, don't forget to edit the snippet...","categories":["login"],"code_type":"php","needs_auth":"1"},{"library_id":16244,"title":"Scroll Progress Bar","code":"","note":"Display a progress bar at the top of the site as the user scrolls.","categories":["archive"],"code_type":"php","needs_auth":"1"},{"library_id":59,"title":"Set a Minimum Word Count for Posts","code":"\/**\r\n * Prevent publishing posts under a minimum number of words.\r\n *\r\n * @param int $post_id The id of the post.\r\n * @param WP_Post $post The post object.\r\n *\r\n * @return void\r\n *\/\r\nfunction wpcode_snippet_publish_min_words( $post_id, $post ) {\r\n\t\/\/ Edit the line below to set the desired minimum number of words.\r\n\t$word_count = 100;\r\n\r\n\tif ( str_word_count( $post->post_content ) < $word_count ) {\r\n\t\twp_die(\r\n\t\t\tsprintf(\r\n\t\t\t\t\/\/ Translators: placeholder adds the minimum number of words.\r\n\t\t\t\tesc_html__( 'The post content is below the minimum word count. Your post needs to have at least %d words to be published.' ),\r\n\t\t\t\tabsint( $word_count )\r\n\t\t\t)\r\n\t\t);\r\n\t}\r\n}\r\n\r\nadd_action( 'publish_post', 'wpcode_snippet_publish_min_words', 9, 2 );","note":"Force your authors to write posts that have a minimum length.","categories":["admin"],"code_type":"php","needs_auth":""},{"library_id":61,"title":"Set oEmbed Max Width","code":"function wpcode_snippet_oembed_defaults( $sizes ) {\r\n\treturn array(\r\n\t\t'width' => 400,\r\n\t\t'height' => 280,\r\n\t);\r\n}\r\n\r\nadd_filter( 'embed_defaults', 'wpcode_snippet_oembed_defaults' );\r\n","note":"Set a max width for the embeds using oEmbed in the content.","categories":["admin"],"code_type":"php","needs_auth":""}],"links":{"snippet":"https:\/\/library.wpcode.com\/api\/get\/"}}