I’m not sure if you’re trying to use WordPress functions outside of the actual WordPress application, but to accomplish this you simply need to do:
require( 'path-to-wordpress/wp-load.php' );
at the top of your file, if the path to the WordPress application is in fact $_SERVER['DOCUMENT_ROOT']
then you would do
require ( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
Related Posts:
- Add screen options to custom admin pages
- Add self-closing shortcode button to TinyMCE in WP 4.6
- Completely remove WP_Admin_Bar for specific user roles
- WordPress and PHP Sessions – Security and Performance
- WordPress Hook for user register
- How to make repeated component/block in Gutenberg
- Must-use plugins autoloader: How to use get_plugins() correctly?
- Changing upload directory for plugin uploads only
- Upload file to remote storage
- How do I conditionally enqueue script for CPT single post type with plugin?
- Is it possible to remove next-post / previous-post with out creating a custom template?
- wp_localize_script $handle
- Escaping built-in WP function return strings
- Custom Rewriting to Plugin with Parameters
- Help adding image upload functionality to widget
- Why won’t register_setting() create a setting?
- One time username change from frontend?
- How to extend a plugin like we do a theme?
- How to add custom text in wordpress logs
- Rewrite url for existing page without flush_rewrite_rules
- How to override a function call in functions.php?
- Front-End Interfaces Without Shortcodes
- Is there a way to loop through a shortcode datasource to create a table?
- Execute plugin for specific user role(s) only
- How can I render shortcode so that its not cached by Caching plugins?
- WordPress REST API, run long background job
- Make a list with header and subtext in Gutenberg blocks
- Get the post id as early as possible
- Does WordPress support WebP images?
- How plugins_loaded works?
- Enqueue scripts in footer
- Is It Always a Best Practice to Decouple the Frontend from the Admin Area When Developing a WordPress Application?
- the_editor() function
- How To Prevent Certain Folder To Be Overwritten During Plugin Update?
- Including the necessary functions for a custom ajax registration form
- Why doesn’t my simple the_title filter get applied?
- WordPress clean internationalization for menus?
- Dashboard – get status and position of metaboxes and pass them to ajax method
- JSX in WordPress Plugin Development
- W3 Total Cache JS and css Minify folder are empty
- Force HTTPS 301 redirect with hook
- Including comments meta box on a plugin page
- wordpress JSONAPI introspector always limits number at 10?
- TinyMCE editor turns white on Biographical info [closed]
- How I can use order by of the custom post title?
- Custom Post Type to override theme’s CSS & HTML from Plugins Dir?
- How to create custom settings page for custom plugin
- Move some files of plugin to the root directory with plugin activation
- Internationalizing Plugin
- Update File Once Every 30 Days
- Taxonomies within plugin invalid
- Make Database query only when option is updated
- Unable to get a simple plugin admin page to work
- Use npm and wp-env to make production bundle
- Looking for a better way to initiate cron job
- shortcode executed in the page editor
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Form using admin-post.php gives 404 after submission
- per blog metadata for plugin
- AJAX call to admin-ajax.php by subscriber returns home page
- How to use gettext for specific user role
- Custom Post Type Object – Undefined Variables
- Best way to ping for the API changes in the wordpress?
- How to translate wordpress backend to another language
- Form submission to another page returning 404 error [duplicate]
- How does “Your comment is awaiting moderation” work?
- WordPress plugin advice: suggestions for writing a plugin the correct way
- How to link to custom “archive like” page with custom permalink rules “dynamically”
- rewrite_rules problem
- Creating an ics calendar from custom post type
- Catch metabox values in Plugin
- Dynamic page generation upon purchase of a product
- Custom post type change permalink query
- How to show the posts listing on dashboard or custom page in admin panel?
- Settings API not saving
- Allowing duplicating users with same user_login and user_email
- Updating the_post content is only working with Twenty Twenty theme
- Scripts/styles not loading on cloned WP Site when logged in
- Save in my custom admin page and redirect to the saved object
- How to display archive by selecting year and then selecting month
- Why does unzip_file always return true but nothing happens?
- How can I map a specific URL pattern to a plugin for processing
- Issue on Getting Images URL of the Post Gallery
- What happens when you create/edit a menu
- I can install my plugin in localhost but not in my server
- Add_menu_page and saving settings
- Updating Style From WP Options Setting Page
- Change the class of wordpress menu
- WordPress.org how to force expire Cached Banner-772×250 from my Plugin page
- What is the Timeline for the Active Version Pie Chart in the Repository?
- What method would I use to show an image in between X amount of posts on category archive? [duplicate]
- How to change url’s in WordPress when changing domain [duplicate]
- Email verification feature in wordpress social login plugin
- Plugin – Proper way to handle 404 pages?
- Is wordpress plugin development active? [closed]
- WooCommerce adds a newline symbol (\n) between email recipients
- Upload to a specific media folder created by FileBird Lite
- Allow HTML in product attributes and variation for WooCommerce
- How do I modify the error code array used by “shake_error_codes” filter?
- How do I add multiple custom menu Woo-commerce my account page?