get_custom_table_fields()

Returns the value of specific fields from a custom table.

Parameters

get_custom_table_fields( $custom_table_name, [$selectors], [$post_id] )
  • $custom_table_name (string) (Required) The custom table name
  • $selectors (array) (Optional) The ACF field name. Default value false.
  • $post_id (mixed) (Optional) The post ID where the value is saved. Defaults to the current post.

Example

//Return entire row from 'wp_products' table
get_custom_table_fields('wp_products');

//Return name and description value from 'wp_products' table
get_custom_table_fields('wp_products', ['name', 'description']);

//Return name and description of post ID '123' from 'wp_products' table
get_custom_table_fields('wp_products', ['name', 'description'], 123);

Upgrade to PRO