the_custom_table_field()

Displays the value of a specific field from a custom table.

Parameters

the_custom_table_field( $custom_table_name, $selector, [$post_id] )
  • $custom_table_name (string) (Required) The custom table name
  • $selector (string) The ACF field name. (i.e. column name)
  • $post_id (mixed) (Optional) The post ID where the value is saved. Defaults to the current post.

Example

Display a value from the current post

<h2><?php the_custom_table_field('wp_products', 'name'); ?></h2>

Display a value from a specific post

<h2><?php the_custom_table_field('wp_products', 'name', 123); ?></h2>

Upgrade to PRO