The Elementor Hello Theme is a lightweight and minimal WordPress theme designed to work seamlessly with the Elementor page builder. By default, this theme automatically adds a meta description tag to the <head> section of your website’s pages. While this can be useful for some users, it may conflict with SEO plugins (like Yoast SEO or Rank Math) or custom meta descriptions you want to implement. If you need to remove the default meta description tag added by the Hello Theme, you can do so with a simple PHP function.
In this article, we’ll walk through the process of removing the meta description tag using a specific code snippet, explain how it works, and guide you on where to add it.
Why Remove the Meta Description Tag?
The Hello Theme adds a default meta description to your site’s <head> section, which might look something like this:
<meta name="description" content="Welcome to Hello Elementor Theme...">
While this default description is fine for basic setups, there are several reasons you might want to remove it:
- SEO Plugin Conflicts: If you’re using an SEO plugin like Yoast SEO or Rank Math, these plugins typically manage meta descriptions for better control over search engine optimization. The Hello Theme’s default meta tag can interfere with these plugins.
- Custom Meta Descriptions: You may want to define your own meta descriptions for specific pages or posts, and the default tag could override or conflict with your custom settings.
- Cleaner <head> Section: Removing unnecessary tags can help streamline your site’s HTML and improve performance slightly.
Fortunately, WordPress provides a way to remove this tag using its action hooks system.
The Code to Remove the Meta Description Tag
To remove the meta description tag added by the Hello Theme, you can use the following PHP code:
function remove_hello_elementor_description_meta_tag() {
remove_action( 'wp_head', 'hello_elementor_add_description_meta_tag' );
}
add_action( 'after_setup_theme', 'remove_hello_elementor_description_meta_tag' );
Let’s break down how this code works:
1. The remove_hello_elementor_description_meta_tag Function
This function uses the WordPress remove_action function to deregister a specific action that the Hello Theme adds to the wp_head hook. The hello_elementor_add_description_meta_tag function is responsible for injecting the meta description tag into the <head> section of your website. By removing this action, you prevent the meta tag from being added.
2. The add_action Hook
The add_action( ‘after_setup_theme’, … ) line ensures that the remove_hello_elementor_description_meta_tag function runs during the after_setup_theme hook. This hook is triggered after the theme is fully initialized, ensuring that the Hello Theme’s action is already registered before we attempt to remove it.
Where to Add the Code
To implement this change, you need to add the code to your WordPress site. Here’s how to do it safely:
- Use a Child Theme:
- Create a child theme for the Hello Theme (if you haven’t already) to avoid losing your changes when the theme updates.
- Add the code to the functions.php file of your child theme. You can do this via:
- A code editor (e.g., VS Code) if you’re editing files directly.
- The WordPress admin panel: Navigate to Appearance > Theme File Editor, select your child theme, and edit the functions.php file.
- Use a Custom Plugin:
- Alternatively, create a custom WordPress plugin to hold your code. This is a good option if you want to keep your customizations independent of the theme.
- Create a new PHP file (e.g., custom-functions.php), add the code, and upload it to the wp-content/plugins/ directory. Then, activate the plugin from the WordPress admin panel.
- Use a Code Snippets Plugin:
- Install a plugin like Code Snippets to add the code without modifying theme or plugin files directly. This is the easiest option for beginners.
- Add a new snippet in the plugin’s interface and paste the code.
Important: Always back up your site before making changes to theme or plugin files to avoid potential issues.
Testing the Change
After adding the code, you can verify that the meta description tag has been removed:
- Visit any page on your site.
- Right-click and select View Page Source (or use your browser’s developer tools).
- Search for <meta name=”description” in the <head> section. If the code worked, the Hello Theme’s default meta description should no longer appear.
If you’re using an SEO plugin, you can also check that its meta description is being used instead.
Additional Considerations
- SEO Plugins: If you’re using an SEO plugin, ensure it’s configured to add meta descriptions for your pages and posts. Most SEO plugins automatically override or suppress default theme meta tags, but removing the Hello Theme’s tag ensures no conflicts.
- Performance: Removing unnecessary meta tags can slightly reduce the size of your HTML, contributing to faster page load times, though the impact is minimal.
- Theme Updates: By using a child theme or custom plugin, your changes will persist even when the Hello Theme updates.