- This topic has 3 replies, 2 voices, and was last updated 5 years, 11 months ago by
irene.
-
AuthorPosts
-
-
March 13, 2016 at 12:25 pm #6068
ireneMemberHello,
I am so sorry to bother you again.
A while ago I have started a topic: see https://piklist.com/support/topic/empty-post-title-does-not-replace-all-of-the-title/Now the same happened again.
Therefore my question: How come this is happening?
What could be a reason?Greetings,
Irene -
March 13, 2016 at 1:07 pm #6069
ireneMemberTo make things clearer:
wordpress version:4.4.2
piklist version: 0.9.9.7code used for empty post title:
add_filter('piklist_empty_post_title', 'my_new_title', 10, 2); function my_new_title($data, $post_array) { // Grab the new title from the custom field. Replace my_custom_field with your own $new_title = $post_array['_post_meta']['naam'][0]; print_r($post_array); // output die(); // Only filter on your custom post type. Replace my_custom_cpt with your own. return $post_array['post_type'] == 'hond' ? $new_title : $post_array['post_title']; }output print:
Array ( [post_author] => 1 [post_content] => [post_content_filtered] => [post_title] => Auto Draft [post_excerpt] => [post_status] => publish [post_type] => hond [comment_status] => closed [ping_status] => closed [post_password] => [to_ping] => [pinged] => [post_parent] => 0 [menu_order] => 0 [guid] => http://localhost:8888/hondenfokker/?post_type=hond&p=233 [import_id] => 0 [context] => [ID] => 233 [post_date] => 2016-03-13 17:54:56 [post_date_gmt] => [post_name] => [post_modified] => 2016-03-13 17:54:48 [post_modified_gmt] => 0000-00-00 00:00:00 [post_mime_type] => [comment_count] => 0 [ancestors] => Array ( ) [post_category] => Array ( ) [tags_input] => Array ( ) [_wpnonce] => 65f52159f6 [_wp_http_referer] => /hondenfokker/wp-admin/post-new.php?post_type=hond [user_ID] => 1 [action] => editpost [originalaction] => editpost [original_post_status] => auto-draft [referredby] => http://localhost:8888/hondenfokker/wp-admin/edit.php?post_type=hond [_wp_original_http_referer] => http://localhost:8888/hondenfokker/wp-admin/edit.php?post_type=hond [auto_draft] => 1 [post_ID] => 233 [meta-box-order-nonce] => ee13cd8f16 [closedpostboxesnonce] => 627b98b7c3 [hidden_post_status] => draft [original_publish] => Publish [publish] => Publish [_post_meta] => Array ( [naam] => bewaar [geslacht] => Array ( [0] => sex-reu ) [eigenaar] => Array ( [0] => eigendom2 ) ) [_] => Array ( [nonce] => 2b8e9ffd3a [fields] => 4d05fee34f87a1ab00a10073f69538bb ) [filter] => db )
Last time I did not ask you why this was happening, you told what but not the why. I need to understand the why.
-
March 14, 2016 at 12:13 pm #6073
jrcreativeMember -
March 14, 2016 at 5:53 pm #6076
ireneMember@jrcreative
Thanks! Fixed!
-
-
AuthorPosts
- The topic ‘Custom post title’ is closed to new replies.