You can’t use get_the_ID() when you are not in the loop (eg. in nav menus). Fortunately, the the_title filter comes with the post ID in an extra argument.
Change your code to this, to make it work in all places:
function mealingua_title_filter($title, $post_id) {
#some stuff
if (is_front_page() OR is_single() OR is_page()) {
return '<span class="mealingua_title_container_' . $post_id . ' mealingua_title_container">' . $title . '</span>';
} else {
return $title;
}
}
add_filter('the_title', 'mealingua_title_filter', 10, 2);
Related Posts:
- ‘Global’ settings page for multisite plugin
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- How do I show data from gravity forms in my template? [closed]
- Show a different number of posts per page depending on context (e.g., homepage, search, archive)
- How can I add a featured image to a page?
- How to customize a plugin whilst maintaining ability to upgrade
- PHP code on Visual Composer Plugin
- How are plugins in the WordPress plugin directory ranked?
- How can I log a user out of WordPress before the page loads?
- What does a security risk in a plugin look like?
- How to generate/update a XML sitemap without plugins?
- What happens when wp_cron is deactivated in WordPress?
- Integrating Google Maps with custom marker and hover?
- How To Ignore a Filter On Applying Filter the Content In a Function
- Delivering a file instead of wordpress page
- Plugin to restrict login and unpublish content from an author
- How to use wp-ajax in wp-cron
- How to get list of Scripts in Order of Dependencies
- Is it possible to make shortcodes NOT case sensitive?
- Overriding a function in wordpress
- Woocommerce “out of stock” message [closed]
- TechCrunch WP Asynchronous Tasks plugin still works on v4.7.5? [closed]
- Trigger Autosave or disable unsaved changes dialog
- Custom height/width for thickbox in WP Backend
- Cannot access wp-admin after disabling all plugin
- What is Stable Tag in WordPress plugin readme file
- Next and/or previous post content
- WordPress functions give fatal error in included php file
- How To Clean The Malware Infected & Hacked WordPress Websites? [duplicate]
- How to remove style and js from theme and add your own style and js where shortcode is used?
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- Re-naming a theme/child theme whilst maintaining updates
- Get posts from WP_Query and format them on admin_head
- Redux Framework has an embedded demo. Click here to activate the sample config file
- Pull out Advanced Custom Fields in Related post plugin
- mp3 audio metadata upload integration: can I autopopulate title, caption, description from id3 tags?
- Removing Super Cache Plugin
- Can’t Update or Delete Plugins From WordPress
- Set and access global variable
- Insert content of a post into another
- ob_start() combined with wp_query
- Theme/Plugin installation through url on button click
- Enabling plugin failed because MySQL user do not have CREATE permissions
- date/time-picker and file upload (image) fields for custom fields (e.g. with more fields)
- Reference product SKU on WooCommerce confirmation page [closed]
- Jquery plugin not working on single pages
- Why am I getting a “Call to undefined function curl_init()” when I try to use the Sociable plugin?
- Is there a social members only login plugin for WordPress? [closed]
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- Private Page View Counter
- Get all the URLs of the pages that uses a specific shortcode
- Pagination shows Same posts
- Embed PDF into wordpress
- Extending a theme: build new features as plugin or core modules?
- How to auto strip hyperlinks & images in wordpress post
- How can I temporarily remove content from all pages, but leave up URL?
- WP_Table_List and ob_start() memory limit
- How to modify the Loop from a plugin (instead of a theme)
- Switching Code plugins
- help intercepting save_post through plugin
- best way to run a php script away from the template?
- Limiting title characters in the AZIndex plugin
- How to save Setting pages data to the database?
- How to Remove all Traces of a WordPress Plugin?
- How to show posts as custom field in specific post type?
- Create Woocommerce account password post-checkout on thank you page
- Prevent WordPress from sending set-cookie http header
- dokan edit functionality
- Automatic chage password of pages after some time
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- How to add post title to custom php?
- How to Disable Auto Executing Script in A Particular Page Only
- wp plugin adds “pagespeed.css” after each css file
- Looking for Image Slider that is based on default WP Media Library
- Replace Yoast og:image in single custom post type
- How to change the deafult template in WordPress plugin
- How to save the option’s new values plus old value without overwrite old one
- Display post to another website
- catch urls with specific pattern and show specific content for them by plugin
- WordPress Media Uploader : How to add custom button on featured image tab
- Change pricing in Woocommerce based on Category and Product [closed]
- Get a Taxonomy values in an array
- Place content inside the Post Loop
- Re-writing MySQl query for execute faster
- Is there any wordpress function to update a random post every 10 minutes?
- Creating a register settings class that supports extended classes
- WordPress crashes when I click add new plugin
- Getting error “The package could not be installed. PCLZIP_ERR_BAD_FORMAT ”
- Not your usual Class ‘Memcached’ not found error
- Showing author box on post detail page
- What is the correct method for updating post content from a plugin?
- Making a particular kind of search engine with WordPress?
- Next and Previous Pagination button not displaying in WordPress
- SMS messaging twordpress plugin [closed]
- I Need To Display A Specific Product (Called By Meta Field) On It’s Current WooCommerce Category Page
- query_vars in plugin when using custom permalinks
- WordPress Plugin translation not working EN To FR
- Can’t change login logo & css – older plugin data blocking?
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1
- Framework plugin inside wordpress