How To Remove Search From Menu In WordPress: Plugin Or Functions.php File

Photo of author
Written By Charlie Giles

Devoted WordPress fan behind CodeCraftWP. Sharing years of web expertise to empower your WordPress journey!

Disclosure: This post may contain affiliate links, which means if you click on a link and make a purchase, I may earn a commission at no additional cost to you.

Want to remove the search option from your WordPress menu? Follow our guide and learn how to do it using a plugin or by editing the functions.php file. Improve site speed and user experience in just a few steps.

How to Remove Search from Menu in WordPress

WordPress is an incredibly versatile platform for website building, but sometimes you need to make some adjustments to fit your specific needs. One such change that you might want to make is removing the search bar from your website’s menu. There are two ways to do this: using a plugin or editing the functions.php file. Let’s take a closer look at each method.

Using a Plugin

Plugins are a great way to add functionality to your WordPress website. They’re easy to install and use, and there are thousands of options available. To remove the search bar from your menu using a plugin, follow these steps:

  1. Go to your WordPress dashboard and click on “Plugins”.
  2. Click on “Add New”.
  3. In the search bar, type “Remove Search from Menu” and hit enter.
  4. Choose a plugin from the list of results and click “Install Now”.
  5. Once the plugin is installed, click “Activate”.

That’s it! The search bar should now be removed from your website’s menu. Keep in mind that different plugins may have different configuration options, so be sure to read the documentation for your chosen plugin to make any necessary adjustments.

Editing the Functions.php File

If you prefer to make changes directly to your website’s code, you can remove the search bar from your menu by editing the functions.php file. Here’s how:

  1. Log in to your website’s server using FTP or a file manager.
  2. Navigate to your theme’s directory (usually located in wp-content/themes).
  3. Find the functions.php file and download a copy to your computer.
  4. Open the file in a text editor (such as Notepad or Sublime Text).
  5. Add the following code to the file:

function remove_search_from_menu( $items, $args ) {
if( $args->theme_location == 'primary' ) {
$items = preg_replace( '/(.*)(<li.*?search.*?<\/li>)(.*)/i', '$1$3', $items );
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'remove_search_from_menu', 10, 2 );

Save the file and upload it back to your server, overwriting the original file.

Once you’ve completed these steps, the search bar should be removed from your website’s menu. Keep in mind that editing code directly can be risky, so make sure you have a backup of your website before making any changes.

Benefits of Removing Search from Menu in WordPress

Now that you know how to remove the search bar from your website’s menu, you might be wondering why you would want to do so. Here are a few benefits of removing the search bar:

Increased Site Speed

Removing the search bar from your website’s menu can help to increase site speed. This is because the search bar requires additional resources to load and process search queries. By removing it, you can help your website load faster, which can improve user experience and search engine rankings.

Improved User Experience

Another benefit of removing the search bar from your website’s menu is improved user experience. If your website doesn’t require a search function, having a search bar in the menu can be confusing for users. By removing it, you can simplify your website’s navigation and make it easier for users to find what they’re looking for.


Using a Plugin to Remove Search from Menu in WordPress

When it comes to removing search from the menu in WordPress, using a plugin is one of the easiest and quickest ways to achieve this. There are several plugins available that can help you remove the search feature from the menu, and in this section, we’ll discuss how to install and configure one of these plugins.

Installing the Plugin

The first step in using a plugin to remove search from the menu in WordPress is to install the plugin. To do this, follow these steps:

  1. Log in to your WordPress dashboard and click on “Plugins” in the left-hand menu.
  2. Click on “Add New” at the top of the page.
  3. In the search bar, type in the name of the you want to use (for example, “Disable Search”).
  4. Once you have found the plugin you want to use, click on “Install Now”.
  5. Once the plugin is installed, click on “Activate” to activate the plugin.

Configuring the Plugin

After you have installed and activated the plugin, the next step is to configure it to remove search from the menu in WordPress. The steps for configuring the plugin will vary depending on which plugin you choose to use, but here are some general steps that you can follow:

  1. Go to the settings page for the (usually found under “Settings” or “Tools”).
  2. Look for an option that allows you to remove search from the menu.
  3. Select the option to remove search from the menu.
  4. Save your changes.

Once you have completed these steps, the search feature should be removed from the menu in WordPress.

Using a plugin to remove search from the menu in WordPress is a quick and easy solution to this problem. However, it’s worth noting that using too many plugins can slow down your website, so it’s important to only use plugins that are necessary. If you find that you are using too many plugins, you may want to consider removing some of them to improve the speed of your website.

In the next section, we’ll discuss another method for removing search from the menu in WordPress – editing the functions.php file.

Editing Functions.php File to Remove Search from Menu in WordPress

Another way to remove search from the menu in WordPress is to edit the functions.php file. This method requires a little more technical knowledge than using a , but it can be a good solution if you want to avoid using too many plugins on your website.

Accessing the Functions.php File

The first step in editing the functions.php file to remove search from the menu in WordPress is to access the file. Here’s how to do it:

  1. Log in to your WordPress dashboard and click on “Appearance” in the left-hand menu.
  2. Click on “Editor”.
  3. On the right-hand side of the page, you’ll see a list of files. Look for “functions.php” and click on it.

Adding Code to Functions.php File

Once you have accessed the functions.php file, the next step is to add some code to remove search from the menu. Here’s the code you need to add:

php
function remove_search_menu_item( $items, $menu, $args ) {
foreach ( $items as $key => $item ) {
if ( $item->title == 'Search' ) {
unset( $items[$key] );
}
}
return $items;
}
add_filter( 'wp_get_nav_menu_items', 'remove_search_menu_item', 10, 3 );

Once you have added this code, save the changes to the functions.php file. The search feature should now be removed from the menu in WordPress.

Benefits of Removing Search from Menu in WordPress

Now that we’ve discussed two methods for removing search from the menu in WordPress, let’s talk about the benefits of doing so.

Increased Site Speed

One of the main benefits of removing search from the menu in WordPress is increased site speed. When you remove unnecessary elements from your website, such as the search feature in the menu, your website will load faster. This is important because website speed is a ranking factor for search engines, and a faster website can also improve user experience.

Improved User Experience

Another benefit of removing search from the menu in WordPress is improved user experience. When you remove unnecessary elements from your website, it can make it easier for users to navigate and find what they’re looking for. This can lead to increased engagement and a better overall experience for your website visitors.


Editing Functions.php File to Remove Search from Menu in WordPress

If you’re looking to remove the search function from your WordPress menu, editing the functions.php file is a viable option. This method involves accessing the file and adding a few lines of code to remove the search function, and it’s a great option for those who prefer to avoid using plugins.

Accessing the Functions.php File

Before you can edit the functions.php file, you need to access it. There are a few different ways to do this, but the most common method is to use an FTP client like FileZilla. Here’s how to access the functions.php file using FileZilla:

  1. Open FileZilla and connect to your website’s server.
  2. Navigate to the root directory of your WordPress site.
  3. Find the wp-content folder and open it.
  4. Inside the wp-content folder, you’ll see a themes folder. Open it and find the theme you’re currently using.
  5. Once you’ve found your theme, open the folder and look for the functions.php file. Right-click on the file and select “View/Edit” to open it in your preferred text editor.

Adding Code to Functions.php File

Now that you’ve accessed the functions.php file, it’s time to add the code that will remove the search function from your WordPress menu. Here’s the code you need to add:

function remove_search_box() {
remove_action( ‘genesis_nav_items’, ‘genesis_search’, 10, 2 );
}

add_action( ‘wp_nav_menu_items’, ‘remove_search_box’ );

Make sure to add this code at the very bottom of the functions.php file, just before the closing ?> tag. Once you’ve added the code, save the file and upload it back to your server.

That’s it! The search function should now be removed from your WordPress menu. If you’re not seeing the changes, try clearing your browser’s cache.

Using this method to remove the search function from your WordPress menu has a few benefits. For one, it can help speed up your site by reducing the amount of code that needs to be loaded. Additionally, removing the search function can improve the user experience by simplifying the menu and reducing clutter.

Overall, editing the functions.php file is a relatively simple and effective way to remove the search function from your WordPress menu. If you prefer to avoid using plugins, this method is definitely worth considering.


Benefits of Removing Search from Menu in WordPress

Are you looking to improve your website’s speed and user experience? One simple solution is to remove the search option from your menu in WordPress. This may seem counterintuitive at first, but it can actually provide a number of benefits for your website.

Increased Site Speed

One of the main benefits of removing the search option from your menu is increased site speed. When a user types in a search query, WordPress has to process that query and return the relevant results. This can take time, especially if your website has a large number of pages or posts. By removing the search option, you can reduce the number of requests made to the server, which can result in faster page load times.

In addition, removing the search option can also reduce the size of your website’s code. Most WordPress themes include code for the search option, even if it’s not visible on the front-end. By removing this code, you can reduce the overall size of your website’s codebase, which can also improve site speed.

Improved User Experience

Another benefit of removing the search option from your menu is improved user experience. While search can be a useful tool for finding specific content on your website, it can also be overwhelming for some users. If your website has a large number of pages or posts, the search results can be difficult to navigate. By removing the search option, you can simplify your menu and make it easier for users to find what they’re looking for.

Furthermore, removing the search option can also improve the overall aesthetic of your website. Many WordPress themes include a search box in the menu, which can clutter the design and distract from the main content. By removing this element, you can create a cleaner, more streamlined design that emphasizes your content.

How to Remove Search from Menu in WordPress

There are two main methods for removing the search option from your menu in WordPress: using a plugin or editing the functions.php file. Both methods have their own advantages and disadvantages, so it’s important to choose the one that’s best for your website.

Using a Plugin to Remove Search from Menu in WordPress

Using a plugin is the easiest and most straightforward way to remove the search option from your menu. There are several plugins available that can do this, but we’ll focus on the one that we recommend: the Disable Search plugin.

Installing the Plugin

To install the Disable Search plugin, follow these steps:

  1. Login to your WordPress dashboard.
  2. Click on Plugins > Add New.
  3. In the search bar, type “Disable Search”.
  4. Click on the “Install Now” button next to the Disable Search plugin.
  5. Once the plugin is installed, click on the “Activate” button to enable it.

That’s it! The Disable Search plugin will now remove the search option from your menu.

Configuring the Plugin

The Disable Search doesn’t require any configuration, but there are a few settings that you can adjust if needed. To access the settings, follow these steps:

  1. Login to your WordPress dashboard.
  2. Click on Settings > Disable Search.
  3. Here, you can choose whether to disable the search option in the menu, in the sidebar, or both. You can also choose whether to redirect search queries to the homepage or a custom URL.

Once you’ve adjusted the settings to your liking, click on the “Save Changes” button to apply them.

Editing Functions.php File to Remove Search from Menu in WordPress

If you prefer to edit your website’s code directly, you can also remove the search option from your menu by editing the functions.php file.

Accessing the Functions.php File

To access the functions.php file, follow these steps:

  1. Login to your WordPress dashboard.
  2. Click on Appearance > Theme Editor.
  3. In the right-hand menu, click on the functions.php file.

Note: Before making any changes to your website’s code, it’s important to backup your website and create a child theme. This will prevent any accidental changes from affecting your live website.

Adding Code to Functions.php File

Once you’ve accessed the functions.php file, you can remove the search option by adding the following code:

function remove_search_menu() {
global $submenu;
unset($submenu[‘edit.php’][10]);
}
add_action(‘admin_menu’, ‘remove_search_menu’);

This code will remove the search option from the Edit Posts page in the WordPress dashboard. If you want to remove the search option from other pages, you’ll need to adjust the code accordingly.

Once you’ve added the code, click on the “Update File” button to save your changes.

In conclusion, removing the search option from your menu in WordPress can provide a number of benefits for your website. Whether you choose to use a plugin or edit the functions.php file, it’s important to choose the method that’s best for your website. By removing the search option, you can improve site speed, simplify your menu, and create a cleaner design that emphasizes your content.

Leave a Comment