Tag Info

New answers tagged

0

For serializing and unserializing Data in Wordpress, you can use maybe_unserialize and maybe_serialize. If you want to handle the data and add/change values, you could use something like this: $metaarray = maybe_unserialize(get_post_meta($post_id,'_ait-dir-item',TRUE)); //now $metaarray has an array, if it is serialized. If not, $metaarray has a string. ...


0

You should first run the wp_insert_post() which will return the post ID. Then use that post ID to add your custom fields. Use add_post_meta() to add the custom fields. $post_id = wp_insert_post( $args ); add_post_meta( $post_id, 'longitude', $my_long ); add_post_meta( $post_id, 'latitude', $my_lat );


0

Don't user custom fields to fix it, you should better try this: if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ){ $post_id = wp_insert_post( $my_post ); }


0

This is theoretically possible. While there is no explicit way to do this in post insert/update process, all queries go through query filter before being run on database. Practically this is a no go. The level of complexity in WP's handling of post querying is incomprehensible and full of edge cases. There is no easy telling how much would break over ...


1

first you should set the taxnomy in custom post type you have just set only for post title post content post comments you did not set for custom taxnomy $post = array('tax_input' => [ array( <taxonomy> => <array | string> ) ] // For custom taxonomies. Default empty. 'page_template' => [ <string> ] // Requires name of ...



Top 50 recent answers are included