Hot answers tagged

2

I've refactored your code below to add some of the repetitive items into functions and tried to improve your variable names a little. The new variable names and function names should clearly indicate their intended purpose/data. A rule of thumb worth remembering is the concept of DRY (Do not Repeat Yourself). const createArraywithJsonData = function(...


1

If you're working with a custom table you have within your database, which you use for WP, then using $wpdb is the way to go. Just remember to use prepare, if there's any user submitted stuff included in the query. If on the other the data is stored as posts (with custom post type) with associated post meta, then WP_Query with meta_query argument is more ...


Only top voted, non community-wiki answers of a minimum length are eligible