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:
- The the_post_thumbnail without srcset?
- after_setup_theme always runs
- WP 3.4 – what action/hook is called when theme customisation is saved?
- What WP folder can I use to write files to?
- Why I can’t add a CSS style in this WordPress theme?
- Is it good to rename theme folder downloaded from WordPress.org?
- Editing the custom background CSS
- What, specifically, should be included in theme_name_setup()?
- How to get gallery images?
- Is the theme customizer slowing down my site?
- How can I get wp_head() as a string instead of echoing it?
- What does “Do not deregister the jquery script in the administration area” mean?
- What is the best book to learn how to make themes for wordpress?
- Symlink a directory to wp-content/themes
- Single Page WordPress Theme – Using page templates
- What are WooCommerce starter themes? [closed]
- 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()?
- Example of a theme organization without all the default wp files in root
- new theme permissions don’t allow me to edit
- Disable the Custom Internal CSS added by theme.json for Certain Pages
- Unwanted blank lines before tag
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- Which theme foundry has clean coded themes, where code is poetry [closed]
- How do you protect a premium theme from being copied?
- How can a Theme Contain no Header File or Footer File?
- Custom Nav Walker Displaying Values in Sub Menu
- How to configure wordpress to work with Vuejs with SSR and without hashbang
- How can one update a theme on a live site without interruption?
- Sub folder CSS that’s read by Admin panel
- Some translations do not work in my template class
- Some doubts about how to show posts in a custom theme?
- Dequeue a style file which is making website load slow!
- WordPress not registering Theme Customization Section
- “add_theme_support” for custom footer color?
- qTranslate with my own theme and settings
- Stylesheet not linking
- How to control layout of posts on page?
- Override template file i subfolders
- Theme Development for WordPress Multisite Installation
- Include Parent functions.php in Child Theme functions.php
- Internal error 500 accessing Theme > Customize
- create category on theme setup
- Theme Development: Starter Content after hook
- Is there any WordPress theme for Self Storagae just like Spacer [closed]
- Customizer: save setting/control content to post/page
- WordPress get_template_part() function not working
- Where am I doing wrong in my theme menu?
- How can my theme allow users to take advantage of advanced html tags in posts
- How to place HTML tags in content from the_content()?
- WordPress Theme Creation [closed]
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Integrate WooCommerce theme with a WordPress theme [closed]
- Automated Footer information
- How do you use WordPress for a website that’s not in a blog format?
- Managing WordPress Theme
- theme style is applied on the dhasboard rather than the website
- What $handle does WordPress use for a theme’s implicit style.css?
- How to track a users last visited page?
- In a Gallery with limited image posts, how do I not limit images on single post?
- LESS not working in WordPress [closed]
- Unwanted empty line at the beginning of document
- How to add custom page elements to the WYSIWYG editor?
- Why is my container argument not working for wp_nav_menu() [closed]
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- How to use the _S framework
- help needed for suit designing tool
- Open portfolio image in light box
- Let visitors show/hide a type of content
- Best practice for implementing a blog page / section in wp_menu_nav()
- How to modify theme content in Thematic?
- how to add a badge on product based on filter?
- how to create/register menu items that can be added to menus later
- Why nav_menu_css_class doesn’t work with apply_filters?
- WordPress and Semantic UI
- Customizer API Multi Sections in single Panel
- WordPress theme options checkbox default checked state
- Theme does not allow shortcodes
- Text widget is placing everything side by side. I want to post it above
- What is an alternative to not using child theme to customize a WordPress theme?
- Creating a theme just to deploy a single page
- Menu names not getting translated
- How to generate a rtl.css file for themes?
- Get property of non-object on theme activation
- change wordpress website logo url [duplicate]
- wp_editor some functionality not working on custom theme
- Update modified Shopify third-party theme [closed]
- hide/show a div in wordpress
- Providing updates to your WordPress theme
- One-Page WordPress Template
- Weird ‘theme update’ error [duplicate]
- How one category can have different fields?
- How do child themes work?
- Fail to install theme on development copy of WordPress on Webmatrix
- How to prevent XSS attack in wordpress theme?
- Featured Image Module Randomly Disappears
- adding navigation to genesis themes
- Show post thumbnail only if it exists using timthumb
- Getting all months in one year WordPress Archive
- Trying to create a cutom query with pagination and page 2 breaking. Any help?