I want to disable auto-creation of the title below the image
-
Please see the yellow box below the image.
That’s not what I wrote. It’s an automatically written title.
That letter appears under every image you upload.I want to deactivate the title so that it doesn’t show
What should I do?Link to the post: https://www.dategom.com/?p=22238

-
To disable the auto-creation of the title below images in WordPress, this often refers to the behavior where WordPress automatically generates an image caption based on the image file name (or the title you set when uploading the image). Here’s how you can manage or stop this: 1. Disable Title Attribute for Images in WordPress
By default, WordPress adds an image title attribute that often appears as a tooltip or a caption when you hover over the image. You can remove or disable this behavior through the functions.php file of your theme. Solution 1: Remove Title Attribute from Images
You can disable the image title from being displayed as a tooltip when users hover over an image. This will stop the image title from showing up below the image:
- Step 1: Access your theme’s functions.php file (you can find this in your theme folder or via the WordPress Admin > Appearance > Theme Editor).
- Step 2: Add the following code to functions.php:
function remove_image_title_attribute($content) { $content = preg_replace('/<img[^>]+title=['"][^'"]*['"]/', '', $content); return $content; } add_filter('the_content', 'remove_image_title_attribute'); add_filter('widget_text', 'remove_image_title_attribute'); add_filter('widget_text', 'remove_image_title_attribute'); add_filter('the_excerpt', 'remove_image_title_attribute');- This code removes the title attribute from all images in the content (posts, widgets, and excerpts). It prevents the title from showing when hovering over the image.
Solution 2: Prevent Image Title from Being Added Automatically
When you upload an image, WordPress might automatically set the image title to match the file name. You can disable this automatic title generation by adding the following code to your
functions.php:function disable_image_title_on_upload($data, $post_id) { // Check if the file type is an image if (strpos($data['file'], '.jpg') !== false || strpos($data['file'], '.png') !== false || strpos($data['file'], '.gif') !== false) { $data['title'] = ''; // Clear title field for images } return $data; } add_filter('wp_handle_upload_prefilter', 'disable_image_title_on_upload');- This will prevent WordPress from automatically adding a title to the image during upload.
2. Manually Edit the Image’s Title and Caption
If you’re seeing a title below the image and it’s being generated by a caption, you can manually edit the image caption and title when inserting it into a post or page:
- Step 1: When you insert an image into a post or page, click on the image in the editor.
- Step 2: In the block editor, look to the Block settings panel on the right side.
- Step 3: You will see fields like Image Title and Caption.
- Title: This is where WordPress might automatically set the image title.
- Caption: If there’s text below the image, it’s usually the caption field.
- Step 4: You can clear or modify the Caption field to remove or change the text under the image.
3. Check Your Theme or Plugins
Sometimes themes or plugins might be adding titles to images below them (or in tooltips). In such cases:
- Check your theme settings: Some themes have options for controlling image behaviors, like showing/hiding captions or titles.
- Check for Plugins: Plugins like image galleries or sliders can sometimes control image display and captions. Disable or configure them to avoid showing titles under images.
Conclusion
- Remove Image Title: Add code to
functions.phpto remove the title attribute from images. - Disable Auto Title: Add code to prevent WordPress from automatically setting a title on image uploads.
- Manually Adjust Captions: Modify or delete the caption when adding images to posts.
This should help you control or disable the auto-creation of titles under images! Let me know if you need further clarification or additional help.
- The topic ‘I want to disable auto-creation of the title below the image’ is closed to new replies.