Title: Found data integrity issue, proposing a fix
Last modified: August 22, 2016

---

# Found data integrity issue, proposing a fix

 *  Resolved [Jon Christopher](https://wordpress.org/support/users/jchristopher/)
 * (@jchristopher)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/found-data-integrity-issue-proposing-a-fix/)
 * First: thanks a ton for this plugin, it’s awesome! I ran into what might be an
   edge case but found a fix that I’d like to propose.
 * Long story short: I ran into an issue where CFS data wasn’t being properly retrieved
   after I made a call to `get_category_meta()` when there was no data to retrieve.
   After stepping through the code I found my way into the `getPost()` method of
   the `VirtualPosts` class. It’s using `$post` as a variable name, and calling `
   current($post)` was wreaking havoc on the rest of my page load.
 * Switching all occurrences of `$post` to `$postref` fixed the issue for me, lines
   58 and 67 of `lib/VirtualPosts.php`. I’m wondering if you can take a look and
   let me know if this change can be made?
 * [https://wordpress.org/plugins/cfs-custom-category-fields/](https://wordpress.org/plugins/cfs-custom-category-fields/)

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

 *  Thread Starter [Jon Christopher](https://wordpress.org/support/users/jchristopher/)
 * (@jchristopher)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/found-data-integrity-issue-proposing-a-fix/#post-5371962)
 * Actually, scratch that, it looks like that fix doesn’t actully work, it looks
   to be a problem of calling `get_category_meta()` multiple times for different
   taxonomies/terms on the same page load that may be causing the problem. Has that
   been a problem for you by chance?
 *  Plugin Author [GatorDog](https://wordpress.org/support/users/gatordog/)
 * (@gatordog)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/found-data-integrity-issue-proposing-a-fix/#post-5372138)
 * If you don’t pass the term to get_category_meta(), the assumption is that it’s
   being called from an archive page and will default to the queried object. So 
   if you wanted all the field data for a certain category or taxonomy, eg ‘custom_taxonomy’
   where the slug is ‘my_term_slug’, you’d use the following code:
    `get_category_meta(
   false, get_term_by('slug', 'my_term_slug', 'custom_taxonomy'));`
 * Note that setting the first paramater to false will return all the field data.
   The second argument is the term, which can be gotten by id, name or slug (as 
   in the example).

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

The topic ‘Found data integrity issue, proposing a fix’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cfs-custom-category-fields.svg)
 * [CFS Custom Category Fields](https://wordpress.org/plugins/cfs-custom-category-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cfs-custom-category-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cfs-custom-category-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/cfs-custom-category-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cfs-custom-category-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cfs-custom-category-fields/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [GatorDog](https://wordpress.org/support/users/gatordog/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/found-data-integrity-issue-proposing-a-fix/#post-5372138)
 * Status: resolved