WordPress.org

Forums

[resolved] Execute plugin outside dashboard (3 posts)

  1. Dan-BTP
    Member
    Posted 1 year ago #

    Is it possible to execute a plugin from a PHP script outside the WordPress dashboard?

    I have an XML file, Blog1.xml, that was generated by the WordPress export function. I need to import this file into Blog2, as though I logged into the Blog2 dashboard and chose Tools > Import > WordPress. However, I need to be able to do this in a PHP script outside of the WordPress dashboard. Is this possible?

    Thanks!

  2. bemdesign
    Member
    Posted 1 year ago #

    If you're good with PHP and programming concepts you probably could. As in it's not out of the realm of possibility.

    The tricky parts as I see it would be:
    1) Figuring out what would trigger your PHP code to run
    2) Communicating between two servers on possibly two different domains (cross domain communication)
    3) Making sure your code is secure (you don't need someone to trick your code into loading up a malicious XML file)
    4) Making sure your code has proper error checks and validation to make sure everything runs correctly (so it doesn't crash your server if something fails or goes wrong)

    And of course, the search engine penalty for having the same content posted on two different websites (i.e. if Google and other search engines catch you trying to bump up your rankings this way - your sites may be delisted from Google).

  3. Dan-BTP
    Member
    Posted 1 year ago #

    Thank you for your reply!

    This is only for internal use to update or merge a release version of the blog with a test (new design) version of the same blog (same server; just two completely separate WordPress sites). The test version is excluded from search engines, so duplicate content is not a problem.

    I can handle the trigger for when to run it. I just don't know how to do it in PHP. Can you suggest some code to get me started? Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic