If you’re a developer, or at least know something about PHP, you may find that standard input data types (Google Spreadsheet, Excel, CSV, MySQL query) are not flexible enough for you. You may want to prepare the table data “on the fly”, for example depending on some variables in the URL, or use some other complex logic. We did not want to limit your freedom with wpDataTables, so we introduced serialized PHP arrays as one of the data source alternatives.
Serialized PHP array
In this example we are going to prepare a PHP file that returns ID’s, titles, and text previews from this documentation section using WP_Query. This can also be considered as a demo of WordPress integration.
Let’s see the resulting table first, and then steps how to prepare it.