First of all, don’t do that. Including WordPress’s engine in some external PHP file is not recommended at all. It has more downsides than upsides.
If you want to access WordPress’s functions, create your PHP file inside the theme’s folder, or create a plugin. You can even create an AJAX request if you really need to access some data directly by a URL.
Now, about your error. It seems like you are trying to include wp-load.php
from one of your theme’s files. If it is so, then that’s not necessary. Theme’s files already have access to WordPress’s functions. Just remove the require...
and you will be fine.
Let’s say for some unknown reasons they don’t, and you HAVE to include wp-load.php
. This file exists in the root folder of your installation, and you have to go back 3 times to include it. So it will look like this:
../../../wp-load.php
Once again, please don’t do this. It’s not a good practice.
Related Posts:
- How to get the registered sidebar’s name by its id?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- One button to change all settings in theme customizer?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- Design view breaking on Pages
- Set WordPress Default Template
- Populate editor with some content of a page with a page template
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- How do I link a button I created in theme customizer to a function?
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- get_template_directory adding FTP root folders in urls
- How can I assign separate stylesheets to different pages?
- How to make sure relative URL works when site is not on root domain?
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- Menu to the right of screen on desktop using Bootstrap 4
- Create a custom theme-specific page, invisible in the admin-panel?
- Differences when using the the_time and the_date functions
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- Add a Second Menu to a theme that only support 1 menu
- Changing the template hierarchy
- syntax issue on php 7.4
- How do I publish only one page to production after making changes on staging?
- Custom category code not showing all posts
- Trigger popup in a php if/else statement
- Can’t get page content in WordPress
- Customizer: Output default value in Customizer CSS
- Way to querry data (tags) from a wordpress database?
- WordPress does not load page.php, return 404.php
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Converting HTML Template to WordPress Theme
- WordPress add post format support not working
- How to remove the cufon script from Dzonia Lite theme [closed]
- How do I add custom bulk actions to multiple custom post types?
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- what is the best practice to add new field to an api route
- Error in custom php function doesn’t exist
- Customizer: active_callback and sanitize_callback incompatibility?
- My page.php shows the index.php
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Create Page To Count Comments For Each Post In WordPress Site
- Skt full width basic slideshow problem
- How to disable controls in theme customizer?
- Trying to retrieve post meta
- Is there a way to conditionally check whether a WordPress post title is empty?
- Inject class in body when particular page template is used
- WordPress admin-ajax.php
- What does this mean in wordpress? Easy question
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?
- Separation of presentation and code – WordPress
- Show About and Contact Us page when they’re clicked in the top menu.
- WordPress Customizer Default Image
- How to call multiple functions from multiple files into a WordPress page template [closed]
- How to use theme function in post/page?
- Why in my theme I can’t see all the statics content under the posts?
- Theme not calling Jquery properly
- What is the best way to define constant options for a theme?
- How to add the sidebar to all the pages except the home page? [closed]
- Header not properly displaying on archive.php
- Save Custom CSS file in the upload folder dynamically?
- Warning: printf(): Too few arguments in helpers.php file
- Need php code’s output to display underneath a Divi Module
- How to make function appear in sentence?
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- home.php show blog posts as grid view
- blank white page when post/update/change option etc
- How to Update an old theme for the latest wordpress version
- get_comments_number() returns 0
- Removing “Powered by” footer using child theme PHP [closed]
- How to add aria role and schema markup to custom walker container
- get_page_templates only return templates with “home” in the filename
- PHP Output also in Child theme, but different
- Is there a hack for using is_page() within the function.php file?
- Randomize Color Scheme Selection in Theme
- Extract and display user infromation on an automatically created page
- How to Display a List of Child Pages For a Parent Page in WordPress
- Show different website layout if no sidebar added
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Why in this WordPress theme I can’t see the Main Menu?
- Displaying Slider in Front Page (home) using Customizr Theme
- Need advice on theme customizer and child themes
- Toolbar Hidden in a Virtual Page
- call a string/function from database
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Commas in Tag Cloud
- WordPress redirects page query parameter in URL
- Getting text from custom field from customizer
- Need help for some PHP code
- A function to get the content of a page
- How to change basename url for wp-admin?
- how to replace h1 entry title with h2 in category pages only
- Not able to remove caption shortcode from the content
- remove_action from parent theme using child theme functions.php