get_template_directory_uri doesn’t return the directory name, it returns the URL of the directory. file_exists needs a file path, not a file URL.
Use get_template_directory instead, and don’t forget to check get_stylesheet_directory too for those using child themes
Related Posts:
- Disable plugin / plugin action via theme
- Where can I sell WordPress themes and plugins? [closed]
- What are the package and subpackage comment for?
- Experiences with adding Nonces to the comment form
- How to add plugins to wordpress theme?
- Need to create a Theme demo site that features multiple themes
- Get URL of a specific file
- How do I make my wordpress page more friendly for mobile viewers?
- disable active plugins for specific theme
- Check javascript file Proper way in functions.php
- Should I use RIPS tool to test my themes and plugins?
- Make the css of the widget overwrite theme css
- A way to sort WordPress themes? [closed]
- adding a text message beside the comment submit button
- Recommendations for books/resource to get started with wordpress 3 development (plugins/themes) [closed]
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin
- Why are some of my thumbnails not being generated?
- How to Implement “Notice: This theme recommands the following plugin:xyz” in wordpress? [closed]
- Making menu link open in new tab?
- Change settings of get_post_type_object
- Sage WordPress – Plugin Namespace: Not Found
- How to Know if a Plugin can be used with my Theme [closed]
- Not able to open category post [closed]
- Reusable functions and tools (Framework)
- Only Homepage not loading properly
- Using custom JS plugins with WordPress?
- plugin style conflicts, how to override? [closed]
- Globally register styles but enqueue them selectively
- Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes
- Admin Theme customization
- (FES EDD) New vendor submission page is blank
- There is any way to remove post-format filter? [closed]
- WordPress site periodically goes down
- Masonry images not working
- (Big issue) Blog is Getting Down Each day.. what should i do.?
- Custom wordpress Theme and Plugin repository
- How to require users to login when not logged in
- Does WP delete deprecated plugin/theme files on plugin/theme upgrade?
- Is there any hook for theme activation ? or something similar?
- How to use get_template part in the plugin?
- How can I use get header from within my plugin?
- My single.php page does not show the related data to the post which is clicked
- Basic gallery plugin suggestion [closed]
- How to protect WordPress from security scanner [closed]
- how can I query all wordpress users of a blog
- Is it possible not to load theme on a specific page in wordpress?
- I receive taxonomy id
- Theme My Login Shortcode Doesn’t Return Anything
- Include Minit plugin in theme [closed]
- How to extract a .wp-env.json or composer.json containing plugin versions from a production website?
- Moving FB comments at the end of page
- How Do I Uninstall a Current WordPress Theme and Install a Fresh Theme
- What is it and from where it is loaded?
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Blocking Plugin Css to load custom in template directory
- Load CSS files in header of Bones theme?
- How to handle a WordPress blog with articles in different languages?
- display unique post per category
- How to display a widget on a page with no theme?
- navigation among single posts
- After a manual update, themes and plugins that were installed (and still in the directory) are not being seen
- Display WordPress comments before the plugins?
- Mobilepress fails to translate short codes
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- WordPress Cache delete on plugin uninstall
- Unknown theme modal source
- How to override any plugin file in the child theme
- Replace old theme that understand old css (vcex_icon_box css_animation)
- WordPress website will not show menu on a Mobile Device
- Mobile Menu and Mobile Sidebar missing
- Ensure WordPress Theme Uninstalls Completely
- custom fields not displaying on wordpress site
- Ajax Call not Working in Plugin
- Changing the pointing of assets from old server to new server
- Image path in childs theme
- How to get a post views count using ‘WordPress popular posts’ plugin
- Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
- Securing langugae folder
- How to prevent redoing get_posts queries and make results available to other scripts?
- Is it possible to disable a theme programmatically?
- Google trying to index child theme files
- In the WordPress API is there a way to set the width of the post/page container
- how to add custom css at top above all css file for specific url
- How to Call Function From Separate WordPress Install on Same Server?
- What Are the Advantages of Using an mu-plugin
- Automatic updates of plugins and themes outside of wordpress.org
- What is the process for reimplementing a back up WordPress?
- Notice: Use of undefined constant Redux_TEXT_DOMAIN – assumed ‘Redux_TEXT_DOMAIN’
- How to install wordpress theme’s plug-ins?
- White screen and can’t activate themes and plugins
- custom registration form [duplicate]
- Activate plugins by a theme’s functions.php?
- do_shortcodes() isn’t working
- Why does theme need woocommerce to show images / content on front page?
- My Blog page ( posts page ) theme isn’t changing with the new theme [closed]
- Very slow page loads
- WordPress theme is not displaying the correct home page in the Pages section
- How to create new title and its description inside a section in WP Customizer?
- Allowing users to install a predefined bundle of plugins and themes with one action
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1