Title: Duplicate with custom fields
Last modified: February 22, 2023

---

# Duplicate with custom fields

 *  Resolved [jcarrest](https://wordpress.org/support/users/jcarrest/)
 * (@jcarrest)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/duplicate-with-custom-fields/)
 * I create new posts in the forum, duplicating the wordpress entry correctly.
 * But how can I collect a custom field, so that my modules load correctly?
 * In my input the function picks it up like this:
 * $idcamp = get_post_meta(get_the_ID(), ‘id_campeonato’, true);
 * Of course, when I duplicate creating a post, it doesn’t exist. Any glorious ideas?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [jcarrest](https://wordpress.org/support/users/jcarrest/)
 * (@jcarrest)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/duplicate-with-custom-fields/#post-16494470)
 * It’s a bit strange, but I got it working like this:
 * function bannerinfogp(){
   $idgp = get_post_meta(get_the_ID(), ‘id_carrera’, true);
   if (empty($idgp)){$topic_title = bbp_get_topic_title();$entry = get_page_by_title(
   $topic_title, OBJECT, ‘post’ );if ( $entry ) {$custom_field = get_post_meta( 
   $entry->ID, ‘id_carrera’, true );$idgp = $custom_field;}
 * It breaks me down a bit this way. It would be better if it doubled the custom
   field.
 * It would be more appropriate.
 *  Plugin Author [Nick](https://wordpress.org/support/users/nickchomey/)
 * (@nickchomey)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/duplicate-with-custom-fields/#post-16494868)
 * Im not sure what you’re asking for.
 * Do you want help with your custom code or are you requesting a change to this
   plugin’s code?
 * Either way, im not really sure what the problem is/what you’re trying to achieve.
 *  Thread Starter [jcarrest](https://wordpress.org/support/users/jcarrest/)
 * (@jcarrest)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/duplicate-with-custom-fields/#post-16495118)
 * Have the plugin add the post custom fields to the post it creates on the forum.
   I don’t know if it would be possible. I fixed it with my custom code, but it 
   would be much easier if it was already implemented in the plugin.
 *  Plugin Author [Nick](https://wordpress.org/support/users/nickchomey/)
 * (@nickchomey)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/duplicate-with-custom-fields/#post-16501214)
 * To clarify, what you would like is when a new post is created, if that post has
   any postmeta custom fields, those custom fields will be duplicated for the forum
   topic that is created for the comments?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Duplicate with custom fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/bbpress-post-topics.svg)
 * [Post Comments as bbPress Topics](https://wordpress.org/plugins/bbpress-post-topics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bbpress-post-topics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bbpress-post-topics/)
 * [Active Topics](https://wordpress.org/support/plugin/bbpress-post-topics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bbpress-post-topics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bbpress-post-topics/reviews/)

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * 4 replies
 * 2 participants
 * Last reply from: [Nick](https://wordpress.org/support/users/nickchomey/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/duplicate-with-custom-fields/#post-16501214)
 * Status: resolved