You are missing to load files that will make $wpdb and other WordPress function available in the context. You can include some php files to emulate the WordPress context
include_once('../../../wp-config.php');
include_once('../../../wp-load.php');
include_once('../../../wp-includes/wp-db.php');
$data = $wpdb->get_results("SELECT * FROM " . $table_prefix . "posts");
var_dump($data);
Related Posts:
- Add Google Analytics manually, or use a plug-in?
- Custom pages with plugin
- How to catch/what to do with a WP Error Object
- How can I see all the actions attached to an “add_action” hook?
- Do plugin files have to follow a specific convention to be “picked up” by WordPress?
- Can’t set proper WooCommerce language translation [closed]
- Echo simple string in Plugin
- Get selected values from checkboxes and radio buttons via Gravity Forms gform_after_submission hook [closed]
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- how does wp.media javascript library work?
- Updating WooCommerce variable product stock issue
- Intercepting a add_action
- WordPress pods io – Rest API for fetching fields information for custom post type
- How can I show drafts in wp_dropdown_pages list?
- Include files for a plugin not including
- Missing argument 2 for wpdb::prepare() Issue
- Can Not Redirect from Plugin-Registered Admin Page
- Why does my hand-written plugin installer fail to find `request_filesystem_credentials`?
- How to Reload the Dashboard After Clicking Update in Quick-Edit?
- How to make a WP admin button/menu similar to Jetpack Notifications?
- How to upload thousands of images?
- I need to generate the CSS for my plugin from a function, how do i map a request to a function in the front-end?
- Using ACF to display data on all pages
- Why is wp-cron only executing on page visit?
- How to remove the woocommerce_checkout_process action hook in woocommerce if particular project in cart [closed]
- WordPress Automatic Plugin Update Renames Plugin Directory
- When to call add_filter
- Create a list-style post of popular posts for the week?
- Date calculations from 2 custom fields
- Easiest way to add dropdown to a page
- WPBakery JS composer unused css [closed]
- DROP TABLE with uninstall hook not working
- How to save generated JWT token to cookies on login?
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- Is there any way to use google input tool or any other language keyboard with WordPress [closed]
- How to replace wordpress default text editor (TinyMCE) with a custom one.
- Consolidate plugin functionality into a theme
- Setup page on first login on multisite
- Constant Contact plugin forbidden error
- Know which plugin is calling JS in wp_head()?
- How do I disable an update for a specific plugin?
- changing posts layout in ultimate member profile plugin
- WooCommerce Force Display of Base Country Order Addresses
- Security and Must Use Plugins
- Problems with migrating a WooCommerce orders [closed]
- Get User_id outside wordpress,
- HTTP 500 error after plugin install
- echo statement displayed on front end
- Editing wp-config.php
- Change the layout of action links under the plugin names
- How can i add simple code in only in posts by function.php
- The add_action(‘register_form’) isn’t effecting my registration form
- Store plugin page content in wp_options?
- HTTPS connection with wampserver for “Facebook for WordPress” plugin
- Each User has a Personal Blog
- Pagination not working
- looking for a multi-user hello-world plugin
- Unable to use custom taxonomy with front end post form
- Bulk User Deletion
- Links to plugin files not resolving
- Transfer from register plus to register plus redux plugin
- product available stock day by day
- How to search post titles with whole words only, but not the exact word only?
- Can I disable xml-rpc by setting it to false?
- Cron: Update four post at Hour
- submit two file input fields in the same form
- Add post attachment images their links
- elementor development – custom widget like an inner section widget
- How can I change page content for good once a button is pressed?
- Google Maps for Woocommerce Checkout
- WordPress Admin login redirect to homepage
- Get and Update Most Meta Value as an array in HTML form
- How to upload PDF from Front-End and post automatically?
- WordPress error after installing plugin “Internal Server Error” [closed]
- ACF Taxonomy search on backend (Relationship field)
- Template conflict with WC Payment Method
- wp_insert_post() post_author and return post_id are not working
- Different email notifications (about pending posts) to different users
- Multiple Checkbox
- Template redirect inside of plugin not redirecting
- Theme specific plugin, how?
- How to call uninstall.php?
- Fatal error with jigoshop and woocommerce
- Plugins enqueuing jquery in head
- How do add_action and WP_Query
- overwrite a plugin function in functions.php
- How to list the categories by custom taxonomy created?
- Allow users to enter and edit data in one-to-many configuration
- From a legal perspective, is it okay to customize a plugin’s code?
- How to make is_admin() return false when I need it to?
- Facebook comment into my blog
- Distribute post content through several divs [closed]
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- contact form 7 captcha support anyother captcha plugin? [closed]
- How can I utilize the same “show more” functionality that I see in superuser on my own WordPress site?
- WDTException: [0]: One or more columns doesn’t have a header
- Footer option is missing in Customiser
- Is Nonce Verification (CSRF) required for WordPress Custom Bulk User Actions?
- List Hidden Plugins
- Plugin for better Backend Search? [closed]