If you are outside WordPress and want to load Wordpess, you only need:
require ('/path/to/wp-load.php');
In some situations you may want to load only some WordPress functions, for example:
define('SHORTINIT', true);
require ('/path/to/wp-load.php');
require( ABSPATH . WPINC . '/formatting.php' );
require( ABSPATH . WPINC . '/meta.php' );
require( ABSPATH . WPINC . '/post.php' );
//Load more files if you need
Anyway, I think this is the wrong way. You say that you are in a WordPress page, so why do you get outsite WordPress? Are you making an Ajax request? If so you should use the Ajax API. See:
Related Posts:
- How to include checkbox in widget backend form?
- Using register_activation_hook in classes
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- How to hide get_theme_mod if field empty
- renaming an admin menu item with decimal array index number
- How to get the original price of the product in woocommerce?
- How to make sure that only one wp_cron() runs at a time?
- Replacing the NavWalker dropdown element
- Fatal error: Call to undefined function wpsc_cart_item_count()
- No wp-config.php file on local install of wordpress – site still displays
- Widgets not showing in my custom theme
- Edit category output
- integrating external php library into wordpress- the right way
- To echo or not to echo?
- Different background-image by category
- enqueue multiple Google fonts with multiple weights and styles (italic)
- How to limit the content coming from wordpress shortcodes?
- What is the fastest way to load PHP functions that are only used in one theme template?
- Writing scripts using WordPress / WooCommerce classes?
- storing wp_head in a variable?
- Get taxonomy terms only of the WP_Query current posts
- Change description on specific WooCommerce product status change
- How do I attach a php file to an arbitrary slug and still have access to the wp-core functions?
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- Passing PHP Function Arguments from CLI vs URL
- Is_template how to add one more template [closed]
- Open post-content in archive page in a Modal box with bootstrap
- Creating own shortcode – echoeing php variable based on JS variable
- How to modify URL (add GET values) after front end form submission?
- Sort meta-value in the sequence array in pre_get_post
- Error: options page not found
- Filtering a Database Query
- anyway to put inside a $outprint=sprintf()
- Can’t save php string to a custom field
- Blob file download problem
- Login redirect. Check user meta and redirect accordingly
- Lost in trying to create user database system
- Local WordPress with WAMP downloads files out of Nowhere
- Need help with Code Correction php+wordpress
- Remove   from the_excerpt
- Why is my max_upload_filesize being limited to 2M? [duplicate]
- Errors being created by admin-ajax.php
- Posts are not looping through correctly
- Can’t pass the variable from a select to PHP query
- form $_post action value gets truncated after it passes through two forms
- Deactivate a plugin on wp version
- Ajaxurl suddenly not defined
- How to echo the_title from an array of posts?
- the_post_thumbnail issues
- linked php file not executing php
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- WordPress -> If Is Role Subscriber Show Image?
- Using color schemes with Color Picker
- Payment field disappears on custom Paypal plugin
- Add other class content with reference class value
- how can i update my postmeta without losing old data?
- Slug duplicates once clicking on link
- How to retrieve quantity input field by id in woocommerce
- Language does not switch while cache is enabled
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- My single.php page skips the first div tag
- Limit content size by character or word in database
- String replace for Login/Logout concatenation problem in menu
- PHP call_user_func_array() error
- Redirect after login depending on the URL
- Searching a custom WP table and displaying results in an HTML table
- Handling form actions in WordPress
- Set user status to absent on WordPress
- Customizer: How to Sanitize a Decimal Number Range
- Obtain wordpress user role
- Shortcode’s output to use as other shortcode’s parameter
- PHP code printed into CSS classes
- Displaying POST content with HTML tags and all
- How to hook into the subscriber /wp-admin/index.php page?
- What syntax is this? “{{post.price}}”
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Retrieving specific images from Media Library
- direct query to post_meta table
- Can’t put a hyperlink on Featured Post’s Image
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- Notice: Undefined index: fix with isset [closed]
- Include administrator in author list
- Pass php to database in JQuery: With AJAX?
- List sibling pages widget, exclude current page
- WP Simple Fields – Single repeatable field inside repeatable field group
- get_permalink returning first letter
- Path for contact form file
- File Upload with Server in safe_mode
- WP plugin updates [duplicate]
- Custom Archive Page
- Load files content [closed]
- Shortcode for Visual Composer Grid fails turning string to integer
- Upgrade wordpress core programmatically with PHP [closed]
- Too many if’s and else if’s ?? – Must be better way [closed]
- Implement OAuth2 in custom plugin
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to set variable to specific field when querying
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?