Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress programmatically set acf taxonomy term

$cat_id_1 = 100; // Term association that is actually output as a term_id
$cat_id_2 = 100; // Term association that is actually output as a term_id

$post_arr = array(
  'post_title'    => "My title",
  'post_status'   => 'publish',
  'post_type'     => 'page',
  'post_parent'   => $parent_id,
  'post_name'     => "my-slug",
  'meta_input' => array(
    'acf_name_of_field_1' => array($cat_id_1) /* #id of term */,
    'acf_name_of_field_2' => array($cat_id_2) /* #id of term */,
  )
);

wp_insert_post( $post_arr );
Comment

PREVIOUS NEXT
Code Example
Php :: fuzzy search in php with percentage 
Php :: laravel return new tab 
Php :: : in php 
Php :: string length php online 
Php :: add backslash to path wordpress 
Php :: modifier un formulaire php 
Php :: $query-free_result(); 
Php :: wordpress code 
Php :: Required parameter follows optional parameter (500 Internal Server Error) php 
Php :: tcpdf Array and string offset access syntax with curly braces is deprecated 
Php :: Access directory above php 
Php :: laravel eloquent where if a variable has value 
Php :: WooCommerce: Add Content to a Specific Order Email 
Php :: The video failed to upload video in laravel in cpanel 
Php :: DB::raw update query in laravel 
Php :: laravel view not created using foreign keys 
Php :: Donut chart in PHP 
Php :: yii form custom label 
Php :: set additional params to form laravel 
Php :: how to read laravel query string with dash 
Php :: GZIP COMPRESSION Using PHP 
Php :: remove nul value aray php 
Php :: get next day date in php 
Php :: get table row data onclick 
Php :: php collapse common columns in associative array 
Php :: order table in laravel 
Php :: use app http models in laravel 8 
Php :: Lumen framework promise 
Php :: undefined variable require_once 
Php :: show only fatal errors php 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =