Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6641445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:48:43+00:00 2026-05-25T23:48:43+00:00

I need to develop a script using WordPress PHP that will run with the

  • 0

I need to develop a script using WordPress PHP that will run with the Plesk Scheduled task. I’ve seen a few topics with this on stackoverflow and the web, but I can’t seem to get the wordpress or script to work. I’m fairly new to this, so I need a good step-by-step guide.

Basically, I want to run a PHP Script using the command line. (what’s the command to do this?… I had “php -q /path/to/file.php” but not sure if that’s it.)

Secondly, with this script, I need to be able to use WordPress commands such as query_posts, add_post_meta, get_post_meta, etc.

I’ve seen elsewhere that I need the following at the top of the php file:

#!/usr/bin/php
<?php

$_SERVER = array(
  "HTTP_HOST" => "http://example.com",
  "SERVER_NAME" => "http://example.com",
  "REQUEST_URI" => "/",
  "REQUEST_METHOD" => "GET"
);


require_once('/wp-load.php');
require_once('/wp-blog-header.php');

Is that it, or do I need more? I assume I can place the PHP script in my root WordPress directory and run it from there?

I’ve got the entire PHP part working, and can run it if I include it in a WordPress page and simply load that page. So I know the WordPress part works.

I just need that other portion to get it working with the scheduled tasks.
Thanks in advance for all your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:48:44+00:00Added an answer on May 25, 2026 at 11:48 pm

    Yes that’s it. Actually, all you need to do is set HOST_NAME.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to develop a process that will detect if the users computer has
We develop Linux-based networking application which will run on multiple servers. We need to
I need to develop an app that is using multithreading. Basicly, I have a
I need to develop a CRM system which will allow users to have a
I need to develop a server side application that opens sockets and manages communication
CodeIgniter is brilliant but I'm using it to develop a site where users need
I need to develop a small Flex application that needs to access a MySQL
I need to develop a software that selects a face from a photo where
I'm trying to develop a script which will, in part, generate a list of
I've been using Dreamweaver to develop PHP and MySQL based websites, but as it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.