I got this to work by using include_once(plugin_dir_path( __FILE__ ) . '/../tpls/frontend.php');
The file I’m using include_once
in is itself included from the index.php
file in the plugin’s root directory so, according to the documentation on the subject, a relative path to the file will be relative to the root directory, not the inc
folder.
However, in that case I expected to be able to include the file like this: include_once('./tpls/frontend.php');
but after testing it I found it doesn’t work as expected.
Related Posts:
- Serving precompressed content with Brotli on Apache
- How can I avoid code duplication for a blog with lots of source code?
- How to rename wp-includes folder?
- What’s the correct way to include files in WordPress TwentyTen theme with it’s own jquery scripts and css?
- ABSPATH not working! Any idea why?
- Get current user data from external PHP page
- External system integration with wordpress
- Why does get_template_part() break variables?
- How to pass variables with get_template_part?
- Problems Including File
- How to include core files into plugin
- How to check if txt file exists inside template folder?
- What’s the best way to ‘include’ a file in WordPress?
- locate_template function – File not getting included
- Can not include file from plugin into theme
- Include tags from array, ignore the rest in get_the_tags
- PHP files included within functions.php don’t work from admin area
- Wp Enviroment problem with included file
- How can I include an external file in a post or page?
- Including php file in directory above WordPress installation
- add_feed failed to open stream
- Load content From Include File within plugin
- including Zend Gdata library path error
- What about “inc” (include) files and Child Theming? Is it possible?
- Make changes in /includes/http.php update safe
- Need to override file included in parent theme
- Class works in Admin, not found on Front End
- if statement parent page for child pages
- add_action outside a plugin
- Add page as static html into another page
- Dynamically determine URI to scripts and styles included with a class which could be added from plugin/theme/child theme/mu plugin
- Include another HTML file in a HTML file
- C++ #include guards
- C++ #include guards
- How do I run a file on localhost?
- Already defined in .obj – no double inclusions
- How do I include a JavaScript file in another JavaScript file?
- What is the difference between a .cpp file and a .h file?
- cmath vs math.h (And similar c-prefixed vs .h extension headers)
- Is there any way to use get_template_part() with folders?
- is_plugin_active() returning false on active plugin
- Unable to check if plugin is active
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Include files in functions.php
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- Problem requiring/including plugin files with plugin_dir_path( __FILE__ )
- bloginfo(‘stylesheet_directory’) vs. get_stylesheet_directory_uri() and include(‘file.php’) vs. get_template_part()
- passing argument to get_template_part() or a better way to code
- Show certain terms from custom taxonomy but exclude ‘parent’ terms?
- WordPress “include TEMPLATEPATH” or?
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- How to include template according to meta post value
- Using Includes in Templates in Document Head
- where to include a php file
- Passing variables to template parts
- Add few specific post ids to wp_query
- Conditional Ajax inclusion
- Can I change a variable in a content part while calling it?
- the_author() not working outside the loop
- PHP files included in functions.php don’t seem to work
- Put CSS inside a PHP file and include it the right way
- How to query posts to include specific pages of one post type, and all pages of another post type?
- Include content from one page to another
- Calling a Function in Functions.php from an external PHP script
- code is skipping a div
- get_option() not returning expected value from plugin
- include php file if page_id matches
- Correct and safe way to include php content in my page
- Conditionally include files in functions.php?
- php include not working in custom page
- Post’s ID pattern?
- Using WP functions such as the_title() in an included php file
- include specific Pages to wp_list_pages with filter
- How to include custom PHP file both in header and footer files
- Include a file that has a function in it
- file.php not loaded?
- Include doesn’t work, getting strange path: (/usr/local/php53/lib/php) – Whats wrong? (WPAlchemy)
- Using plugin_dir_path() with WordPress on MAMP
- can’t access some WordPress function from my plugin
- Pull in an “Include” file based on a WordPress Category ID
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Adding a second loop breaks everything
- I’m including a html file in my plugin, but it can’t find its css or js files
- How to add variables to a template
- How to include files in the loop via ajax
- loading a php file to a specific page id
- require happens out of order
- Theme parts path location dump
- How can I include a file related to blog URL? Nothing seems to work
- Undo a function that is not (seemingly) hooked to an action?
- post content includes and seo vs. duplicate content
- WordPress blog set up
- Shortcode not passing variable to included file
- How to include a php file in every post and page [duplicate]
- White Screen When Includding A Folder With PHP Files
- wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file
- Javascript file not included only on home page
- Should I use include(_once) or require(_once) for loading php-file with customizer settings?
- How to include Elementor CSS in custom php file [closed]
- WordPress Includes mejs 404 error