First of all your ajax doing approach is wrong when WordPress offer us great way to do this. Read this one why you should’t use your current approach and then read https://codex.wordpress.org/AJAX_in_Plugins how you can do ajax with wp_ajax
hook. It’s really simple and easy. using this hook you don’t need to call external file neither need to load wp-load.php
Anyway to include wp-load.php file just use ABSPATH
like this
$rootPath = str_replace(ABSPATH,"",getcwd());
Then include
include( $rootPath . '/wp-load.php' );
Moral, For using ajax in WordPress used WordPress wp_ajax
hook instead any others.
Related Posts:
- Add a dropdown to theme customizer
- Editing the custom background CSS
- What is the problem if I use CDN in my WordPress parent theme(built using bootstrap)?
- What, specifically, should be included in theme_name_setup()?
- How to get gallery images?
- Is it possible to use line break in theme description?
- Grab the first paragraph of each post
- Symlink a directory to wp-content/themes
- How to check if post has any tag?
- What are WooCommerce starter themes? [closed]
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to disable the gradient and font size internal CSS added by WordPress when using theme.json
- Is there an error in get_the_tag_list()?
- Which is the simplest theme for WordPress to use it as your base?
- “Cheatin’ uh?” error message on multple theme directories
- Adding WordPress colorpicker in widget settings
- A theme that follows all the best practices to learn from?
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- get_post() function returns post even if it is trashed
- How to highlight the current page in the nav menu?
- How do you protect a premium theme from being copied?
- “Display Site Title and Tagline” checkbox not working?
- Add social icons in a theme through custom admin menu
- file_get_contents Not allowed in Themes?
- How can one update a theme on a live site without interruption?
- Sub folder CSS that’s read by Admin panel
- How do I remove twentyten without ruining what I did?
- Custom theme not visible in Appearance
- Dequeue a style file which is making website load slow!
- Can’t delete theme
- How to add a second stylesheet to the editor
- Stylesheet not linking
- How to control layout of posts on page?
- Single Page theme [closed]
- Include Parent functions.php in Child Theme functions.php
- Can I have two different theme for two different language?
- create category on theme setup
- WP_Comment_Query – Get comments and answers separately
- excerpt() shows different result between remote and localhost(development environment)
- Prefix best practice, should we use framework name or theme name?
- Theme Javascript.php Overwritten Nightly [closed]
- Where am I doing wrong in my theme menu?
- How to add Space between sidebar and footer widget in WordPress theme [closed]
- Call to undefined function add_menu_page() on theme activation
- how to get the post attachement image in full size?
- Can I Set Up Session in WordPress Custom Page
- Is it acceptable for a WordPress theme to not accept widgets?
- Should all references to a text domain be to my current theme?
- Set a featured image as a replacement to the header image
- Theme Customizer not displaying saved values in wp_head (CSS)
- How can I hard code my sidebar?
- Simple child theme modification but links are broken
- Making a WordPress theme based on twentyten
- theme style is applied on the dhasboard rather than the website
- Alignment Problem [closed]
- What $handle does WordPress use for a theme’s implicit style.css?
- StoreFront WordPress theme: How can i create a new Home page with Custom design same as template [closed]
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- Unwanted empty line at the beginning of document
- Why is my container argument not working for wp_nav_menu() [closed]
- best practices for updating wordpress theme
- Theme Checker Text Domain
- help needed for suit designing tool
- How to modify theme content in Thematic?
- How to copy page/post from one theme to another?
- Not sure how to debug this npm install error. This is a wordpress theme that comes with a built-in gulp/webpack task automation [closed]
- How to update mark-up of a gallery block in a custom theme?
- Host Private Custom Theme
- My wordpress theme name isn’t updating straight away
- Customizer API Multi Sections in single Panel
- WordPress theme options checkbox default checked state
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- How can I change this SVG shape that’s generated?
- Adding a second logo next to the main one in header
- How can I not disable my theme when I want to upload a new version of it?
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- How to show some of category in wordpress
- using themename_the_custom_logo() in template-tags?
- Avoiding do_shortcode() loops
- Creating a theme just to deploy a single page
- Custom page template not showing on page creation
- Correct was to customise theme using get_theme_mod in scripts
- how can I re-utilize and class on a child theme
- Weird ‘theme update’ error [duplicate]
- How to figure out which wordpress theme a site was using?
- Incorrect search results in search.php – issue triggered by using `define(‘BodyID’, ‘search’); the_post();` in search.php
- Flexslider not working for my custom theme WordPress
- Redirect to custom login page
- WordPress two sidebar layout or theme
- How to close open divs in post loop
- Display Today’s date outside the loop?
- Standard Way To Do Custom Work Within A Page?
- Add Dynamic Sidebar to Exisiting WordPress Theme [closed]
- How can I install my custom-made theme on a wordpress.com blog? [closed]
- Turning WordPress Into full-featured website?
- .submenu class missing in output from wp_nav_menu
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?
- My wordpress site memory exhausted more than 1GB trying to debug with default
- Full site editing templates folder vs block-templates