I'm looking to do some scripting here so I can easily just have an application or script automatically add a row for me without needing me to use the UI and do it manually.

Is this possible?

  • 2
    What's Tablepress? – bravokeyl Nov 26 '16 at 4:03
  • @bravokeyl tablepress.org -- It is a plugin centred around tables. – Akiva Nov 26 '16 at 4:17

I'd assume you can use WP-CLI for that.

Especially wp db import should be usable for that.

Last but not least the MySQL Command-Line Tool itself, which I'd think is used by WP-CLI for the tasks, can be used.

A word of warning though, there might be some logic to consider regarding the rows you want to add to the table. That logic might not be easily reproducible - or you have to rebuild it - when doing things from the CLI.

So it might be better to use the according and existing functions for the import or adding of rows, because those have the logic implemented already. You can go that route by working with a custom PHP script, the loading of wp-load.php will be necessary - at least. This approach is pretty good documented, so just search this site and the net for it.

  • Thanks I'll look into it right away, and let you know if I get any code working. – Akiva Nov 26 '16 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.