Jump to content

Trouble with code to call custom fields into title


mssbee

Recommended Posts

Hello, I am working on this code and I wonder if I have made some basic mistakes as I am not very experienced at coding:

 

<?php

$mytitle=get_post_meta($post_,'Title', true);

$mycity=get_post_meta($post_,'City', true);

$mystate=get_post_meta($post_,'State', true);

$post_title=$mytitle.$mycity.$mystate;

$postdata = array( "ID" => $post_id, "post_title" => $post_title);

sanitize_post($postdata,"db");

wp_update_post($postdata);

?>

 

Thanks for any help anyone offers!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.