Copying custom field value in to title

Try this: add_action(‘init’, ‘replace_title_logic’); function replace_title_logic() { add_filter(‘wp_insert_post_data’, ‘replace_title_before_update’, 20, 2); add_action(‘wp_insert_post’, ‘replace_title_after_save’, 20, 2); add_filter(‘wp_insert_post_empty_content’, ‘allow_empty_content_for_listing’, 20 , 2); } function replace_title_before_update( $data, $postarr ) { if ( is_int($postarr[‘ID’]) && ($data[‘post_type’] == ‘listing’) ) { $custom = get_post_meta($postarr[‘ID’], ‘ref._nr.’, true ); if ( $custom && ( $custom != $data[‘post_title’] ) ) $data[‘post_title’] = $custom; … Read more

2nd and 3rd Custom Post Type URL’s 404ing

It turns out that global $wp_rewrite; is sitewide as far as I understand but am willing to be informed of the details here. Implementing it with a CPT RUINED my rewrite rules sitewide. Changing the rewrite=> array(‘slug’=>’name’) should have been where I stayed and back to basics on how to manipulate a CPT’s permalink structure.

Categories in custom post types

If you want to use builtin WordPress categories, while calling register_post_type function with taxonomies parameter set to category If you want to create a custom category, then use register_taxonomy function to register a brand new taxonomy with second parameter to be your custom post type name and pass it taxonomy name to register_post_type as explained … Read more

Echo custom field value

Repost for any future googlers from @StenW ‘s wordpress plugin support thread: Github user @atnon made a very similar modification to the code 10 days ago, also using custom-fields (though giving the image a link rather than putting a link in the caption). You can see this code in his pull request. I re-wrote his … Read more

Metabox textarea showing whitescreen

I bet it’s much simpler than it seems… Replace <textarea name=”ourwork[%1$s][client-desc]” value=””></textarea> with: <textarea name=”ourwork[%1$s][client-desc]”>%7$s</textarea> Don’t forget to replace string in jQuery code, too. 2 Problems: You forgot %7$s Textarea don’t use value=”” but put value between <textarea> and </textarea> (if you use value=”” it will be saved but not showed)