I'm creating a wordpress plugin to fetch data from another website, It will be a cron file and I need to store some data in a table.
how do I access $wpdb from that file? do I need to link to a wordpress core file? I'm asking this because it's not a file that will be visible in the admin area or public area, it's jus开发者_运维问答t a file that run's in the background and I guess it will not know $wpdb.
or because it's in the wordpress plugin folder I can just access it? if someone could clear this up for me, thanks.
You need to include 'wp-blog-header.php'
include('/path/to/wp-blog-header.php');
精彩评论