New answers tagged

0 votes

Custom AJAX Endpoint not returning any result

It seems the issue is because of incorrect hook_name. You have used wp_ajax_no_priv_{$action} instead of wp_ajax_nopriv_{$action} Also use wp_send_json() for send response in json format. add_action('...
user avatar
  • 11
1 vote

Custom AJAX Endpoint not returning any result

You need to use the defined namespace as the prefix for the add_action callbacks so that PHP knows which function it is supposed to call. More on this here, add_action in namespace not working The ...
user avatar
1 vote
Accepted

Building a REST API for your web app exposes primary keys of DB records?

You are right, APIs should not expose internal data and structures, but if you depend on APIs not written by you, it will rarely be a good use of your time to develop a different API just feel better ...
user avatar
  • 22.7k
1 vote

Bulk Updating Post Date in 1 day Increments

You could start from today and just work backwards, one day at a time: $start_hour = 8; $end_hour = 17; $date = new DateTime; foreach ( $posts as $post ) { $time = sprintf( /* Left-pad ...
user avatar
  • 35.6k
1 vote
Accepted

How to insert and call new data in wordpress website database through a plugin

The right place to store the data depends on how you will be using the data. From the context, it sounds like metadata might be the right place. There is usermeta if the data relates to one of your ...
user avatar
  • 8,683
0 votes
Accepted

get value from 'terms' table

get_terms does indeed fetch from the terms table, but it does also use a join on the taxonomy table, since you need to specify which taxonomies you want terms for in your get_terms query. If you want ...
user avatar
  • 35.6k
0 votes

Get a custom table to an array

you can take every rows from a table YOUR_TABALE_NAME "SELECT * FROM {$wpdb->prefix}YOUR_TABALE_NAME" then with the get_results() return it into an array $array finally you have somthing ...
user avatar

Top 50 recent answers are included