Custom Meta Description WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
A lightweight WordPress plugin that outputs a clean and safe <meta name="description"> tag for singular content using a custom field, the post excerpt, or trimmed post content. It includes sanitization, REST meta registration, duplicate-output protection for common SEO plugins, and developer filters.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/guisfus/wp-custom-meta-description/archive/refs/heads/main.zipA lightweight WordPress plugin that outputs a <meta name="description"> tag for singular content using a custom field, the post excerpt, or a trimmed version of the post content.
Features
- Outputs a meta description on posts, pages, and custom post types.
- Uses a dedicated custom field:
meta_description. - Falls back to the manual excerpt when no custom description is set.
- Falls back to trimmed post content when no custom field or excerpt exists.
- Registers the custom meta field for REST API compatibility.
- Skips output automatically when common SEO plugins are detected, helping avoid duplicate meta description tags.
- Provides an optional filter to limit the final description length, without cutting words when possible.
- Provides filters for developers who want to customize or disable the output.
Requirements
- WordPress 6.0 or higher.
- PHP 7.4 or higher.
Installation
The GitHub repository uses the wp- prefix only to identify it as a WordPress plugin repository. When installing the plugin in WordPress, use the plugin folder name without the wp- prefix.
Correct plugin folder:
wp-content/plugins/custom-meta-description/
Correct ZIP structure:
custom-meta-description.zip
`-- custom-meta-description/
|-- custom-meta-description.php
|-- README.md
|-- readme.txt
`-- LICENSE
Do not install it as:
wp-content/plugins/wp-custom-meta-description/
Backend installation:
- Create a ZIP with
custom-meta-description/as the root folder. - In WordPress, go to Plugins > Add New > Upload Plugin.
- Upload
custom-meta-description.zip. - Activate Custom Meta Description.
Manual installation:
- Upload the
custom-meta-descriptionfolder towp-content/plugins/. - Activate Custom Meta Description from the WordPress plugins screen.
Usage
Add a custom field to a post, page, or custom post type using this key:
meta_description
The value of that field will be used as the page meta description.
The meta_description key is intentionally simple for custom sites. If a project already uses that field name for another purpose, rename the field in the plugin before deploying it.
If the field does not exist, the plugin will use the post excerpt. If there is no excerpt, it will generate a short description from the post content.
The final description is not limited by default, so custom descriptions are output as entered after sanitization and escaping.
SEO plugin compatibility
To avoid duplicate <meta name="description"> tags, the plugin skips frontend output when it detects one of these common SEO plugins:
- Yoast SEO
- Rank Math
- SEOPress
- All in One SEO
- The SEO Framework
You can still customize this behavior with the developer filters below.
Output priority
The plugin chooses the description in this order:
meta_descriptioncustom field.- Manual post excerpt.
- Trimmed post content.
Developer filters
Disable output
Use this filter to prevent the plugin from outputting the meta description, for example when another SEO plugin is active.
add_filter( 'meta_description_disable_output', '__return_true' );
Modify the generated description
add_filter(
'meta_description_value',
function ( $description, $post ) {
return $description;
},
10,
2
);
Set a maximum description length
add_filter(
'meta_description_max_length',
function () {
return 155;
}
);
Return 0 to disable the character limit.
Override SEO plugin detection
add_filter(
'meta_description_has_seo_plugin',
function ( $has_seo_plugin ) {
return $has_seo_plugin;
}
);
Return false from this filter if you want this plugin to output the meta description even when a known SEO plugin is active.
Security
- Outputs only on singular content.
- Escapes the final tag value with
esc_attr(). - Sanitizes stored and generated descriptions with WordPress text sanitization helpers.
- Registers the post meta field with an edit capability check.
- Does not add admin forms, AJAX actions, REST routes, external requests, cookies, or tracking.
Frontend Footprint
- Outputs one
<meta name="description">tag when no supported SEO plugin is detected. - Does not enqueue frontend CSS or JavaScript.
- Does not write visible HTML comments or branded markup.
Repository structure
custom-meta-description/
|-- custom-meta-description.php
|-- README.md
|-- readme.txt
|-- LICENSE
`-- .gitignore
Notes
This plugin is intentionally small. It does not add an editor UI, SEO analysis, sitemap generation, schema markup, Open Graph tags, or social preview fields.
If you already use a full SEO plugin such as Yoast SEO, Rank Math, SEOPress, or The SEO Framework, you probably do not need this plugin unless you specifically want a lightweight custom meta description fallback.
License
GPL-2.0-or-later. See the LICENSE file for details.
Releases
4 releases.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.