• Resolved Jon Christopher

    (@jchristopher)


    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://ww.wp.xz.cn/plugins/cfs-custom-category-fields/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jon Christopher

    (@jchristopher)

    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

    (@gatordog)

    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.