WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
Move the content of a custom field to the_content(); automatically (3 posts)

  1. Animalejourbano
    Member
    Posted 7 months ago #

    Is there any way to move automatically the content of a custom field to the_content(); wp field?
    I need to make this change in a website with more than 400 articles, and is too hard to make it manually. Is there any easy way?

    Thanks a lot!!!

    http://wordpress.org/plugins/advanced-custom-fields/

  2. Rescuework Support
    Member
    Posted 7 months ago #

    One way is using a filter. You can use the_content filter to modify the content.

    add_filter('the_content','add_my_custom_field');
    function add_my_custom_field($data) {
        // _FIELD_NAME_HERE_ should be replaced with the custom field name.
        $data .= esc_html( get_field('_FIELD_NAME_HERE_'));
        return $data;
    }

    Paste this code to your theme's functions.php.

  3. Animalejourbano
    Member
    Posted 7 months ago #

    Thanks a lot for your help! Let's see if it works.

Reply

You must log in to post.

About this Plugin

About this Topic