The first location where PHP would look for relative path will not be the file you specify include in, but relative to point of entry file (index.php
or whatever).
Files are included based on the file path given or, if none is given, the include_path specified. If the file isn’t found in the include_path, include will finally check in the calling script’s own directory and the current working directory before failing.
My guess would be that your code picks up wp-admin/includes/widgets.php
(because in admin context the point of entry is likely wp-admin/index.php
) instead of your file.
Always write includes like require( __DIR__ . '/includes/widgets.php' );
Related Posts:
- Switching themes without losing widgets?
- Moving WordPress.com theme and widget settings to self-hosted site?
- Why are my widgets not saving when being added to a sidebar?
- Duplicate and change a Theme Widget
- Current theme broken – after server and domain migration
- Changing $before_widget for certain widgets
- adding multiple sidebars on pages
- Embedded Videos (PB) – Not Available
- Hide default “Recent Comments” Widget if there are no comments yet
- Widgets menu does not appear under “Appearance” in dashboard
- Calling widget via function in themes files (hard code)
- Inject widgets from one sidebar into another with PHP
- How to conditionally display widgetized areas in theme customizer?
- Add more widget areas to a theme
- Displaying a widget in sidebar only when no other widgets rendered?
- Style the archives/category sidebar widget via theme
- Restrict access to specific widget field based on user role
- Modifying the markup in the Tag Cloud widget?
- How to override / customize existing Widgets?
- Widgets not showing on sidebars
- Using filter in the widget causes fatal error
- disable default widgets in Responsive theme
- What happened to my Inactive Widgets?
- In a specific blog, the K2 theme does not have a Text Widget
- Removing a widget via theme editor
- sidebar in 2020 theme as a widget
- How to customize a section of a widget only on certain pages or page
- Changing theme folder name disrupts widgets
- No “available widgets” (wordpress 3.2.1 multisite)
- What are all the available parameters for query_posts?
- How do I change the header image height in Twenty Seventeen?
- How do register_sidebar() and get_sidebar() work together?
- Is it OK to remove theme credits from footer? [duplicate]
- What theme is good for posting code? [closed]
- Two instances of WordPress with different URLs and themes
- Is “Featured Content” in Twenty Fourteen done with a plugin, or is it native in WP4.0?
- How can I use WordPress as a job board ? (but free)
- Can I Download a Free WordPress Theme, Edit it and Use it?
- How to create a theme option-menu page to save user values
- Are custom inner theme folders in any way overridable by child themes?
- How to put a banner ad between post 1 and post 2 on homepage only
- How to reverse the pagination numbers of an archive?
- In which directory do I find a specific HTML code of my wordpress page? Some of it seems to be missing after checking all pages [closed]
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- Why do Trackbacks/Pingbacks not appear below my posts/pages?
- Extra themes – ok or bad?
- Theme Customizer – How to create a sub panel
- Setting a static home page and blog page without using the settings
- Use a different template/theme if mobile only on home page
- Can i have a single wordpress site to have two themes ( one for pc other for mobiles)
- Translated my theme (translation not showing up)
- How to use get_page_by_title() with qTranslate?
- wp theme.. Could not create directory
- Multi-level page hierarchy
- How prevent someone from opening my theme directory
- loss of theme options while site deployment in production
- How to install WordPress theme and configure it? [closed]
- How do I get rid of or change the footer in my child theme?
- How can I make some themes usable only by admins?
- Categories gone after changing theme / demos [closed]
- Angular integration with homepage
- Own Theme Customizer displays error message when saving, saving still works
- 1 Database for multiple WordPress themes
- Page has a parent and $post->post_parent returns 0
- How to create different navigation for registered users in WooThemes Canvas?
- Selected template is not respected for home page in WordPress
- WordPress without a theme – help!
- Is it acceptable for a WordPress theme to not accept widgets?
- How to install themes with the demo content?
- Jetpack CSS .screen-reader-text breaks mobile menu [closed]
- Error when using ‘continue reading’
- How to update theme to specific version
- Child theme’s stylesheet cannot load [closed]
- Configure new installed WordPress in live server
- Where does WordPress get the theme name from to check for updates?
- Hi everybody, I have a problem of search box
- Changing an image in header.php
- Updating WordPress Theme Files
- Multiple sub directories for theme template pages
- How to get the theme directory URI?
- My blog suddenly can’t find my stylesheet?
- How to fix Scrape key check failed on WordPress VPS?
- How to use my .mo file in the Divi child theme instead of file in a parent /builder directory?
- How to fix Gutenberg with SiteOrigin page builder deleting content when editing
- Edit a template while still keeping a Landing Page on the main address
- How to allow users to switch to the child theme from front end without plugin?
- Change whole theme depending on resolution
- post_prev & post_next within same category
- Costum Theme template directoy url problem
- How to remove the option data of a theme when that theme is removed?
- How to find out which template the HTML content comes from?
- Convert theme to be based on Bootstrap?
- Include root files into header files
- Commenting in CSS (//) equals “none”? [closed]
- Static posts page is not working
- Cannot use some themes within Managed WordPress of Go Daddy [closed]
- How to track your theme usage on the internet?
- How to add Company Logo to Chosen Theme
- What security risk is not having “default” theme?
- register_nav_menus syntax error, unexpected identifier “register_nav_menus” in