• Resolved Václav Greif

    (@vasikgreif)


    Hi,
    I already specified the various imports using the pt-ocdi/import_files filter.

    Now, I’d need to run one of those from my plugin, after the site in multisite install is created. Is there a function to run a specific import from php? I found the import_demo_data_ajax_callback, but there might be a better way to do this…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Gregor Capuder

    (@capuderg)

    Hi,

    yes, the import_demo_data_ajax_callback is the function that triggers the whole import process, so that would be the best option for you.

    This function is used for the AJAX callback in our plugin and is triggered by the “Import demo data” button.

    Take care!

    Thread Starter Václav Greif

    (@vasikgreif)

    Hi, thanks for reply.

    I tried to do something as simple as:

          $one_click_demo_import = PT_One_Click_Demo_Import::getInstance();
    
           $one_click_demo_import->import_content( 'path/to/imported/file.xml' );
    

    But the problem is the import methods are private. Would you mind changing these to public methods?

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi,

    there is no plan to do so, I’m sorry, that this causes you problems. You could still use the import_demo_data_ajax_callback function, which is public and you can import the content only (xml), if you want to do just that (other undefined imports -> widgets and customizer will be skipped).

    I am planning to rewrite a lot of the code and I’ll keep this in mind, but I have no due date and it might take quite some time…

    Take care!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Run the import from my plugin’ is closed to new replies.