WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field Suite
[resolved] "Array" being returned (6 posts)

  1. swirlyking
    Member
    Posted 2 years ago #

    This is what is on my single.php:
    <h5 class="bottom_line projTitle"><?php echo $cfs->get('project-title'); ?></h5>
    and this is what my Custom Field looks like. But it always returns "Array".
    It was working for awhile, then it stopped - I don't know when. Probably when something got upgraded?

    http://wordpress.org/extend/plugins/custom-field-suite/

  2. logikal16
    Member
    Plugin Author

    Posted 2 years ago #

    This is a bug caused by using a dash in the field name. I'll try to have a patch out within the next few days, but a short-term fix would be to replace the dash with an underscore.

    You *may* also need to update the field names in wp_postmeta:

    UPDATE wp_postmeta SET meta_key = 'project_title' WHERE meta_key = 'project-title';

  3. swirlyking
    Member
    Posted 2 years ago #

    Okay, I'll replace the dash, but this is what I got back with your new line added:
    array(1) { [0]=> string(11) "Sallie Ford" }

  4. swirlyking
    Member
    Posted 2 years ago #

    that fixed it! thank you.

  5. logikal16
    Member
    Plugin Author

    Posted 2 years ago #

    Not a problem.

  6. ujgreg
    Member
    Posted 1 year ago #

    Hope it's okay to reply to the same thread. I get this problem with a select field only. I can't have it anywhere on a page, not in the query, not outside of it. As soon as I change it to a text field, it works and I have other fields displaying as well. Otherwise it displays "array" only. I did add the global cfs as well.

    Tried this:
    <?php echo $cfs->get('situation_setting', get_the_ID()); ?>

    And this:

    <?php echo $cfs->get('situation'); ?>

    Both work if I change it from a select field to a text field.

    Any ideas? Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.