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

  1. swirlyking
    Posted 4 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?


  2. logikal16
    Plugin Author

    Posted 4 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
    Posted 4 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
    Posted 4 years ago #

    that fixed it! thank you.

  5. logikal16
    Plugin Author

    Posted 4 years ago #

    Not a problem.

  6. ujgreg
    Posted 3 years 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

  • Custom Field Suite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.