Forum
perch_blog_sections() Inconsistent behavior
I'm trying to work with perch_blog_sections(). Using:
$sectionsArray = perch_blog_sections(array(
'skip-template' => true,
));
var_dump($sectionsArray);
On first load I get an array like this:
array(2) {
[0]=> array(7) {
["sectionID"]=> string(2) "10"
["sectionTitle"]=> string(5) "Bikes"
["sectionSlug"]=> string(5) "bikes"
["sectionPostCount"]=> string(1) "1"
["sectionDynamicFields"]=> string(2) "[]"
["_id"]=> string(2) "10"
["qty"]=> string(1) "1"
}
[1]=> array(7) {
["sectionID"]=> string(2) "11"
["sectionTitle"]=> string(4) "Life"
["sectionSlug"]=> string(4) "life"
["sectionPostCount"]=> string(1) "3"
["sectionDynamicFields"]=> string(2) "[]"
["_id"]=> string(2) "11"
["qty"]=> string(1) "3"
}
}
^ This makes sense and is something I'm trying to work with. However, when I refresh the page or otherwise revisit the page I get this output:
string(10) "ArrayArray"
Which is not useful. If I shut down my local server and reopen the page I get the first array again. Then upon revisiting I just get a string again.
ANy thoughts on what is going on? Thanks!
Just looked into the perch_blog_categories() function and it seems to behave in the same manner.
Could be a bug with the caching. Does it happen if your site is in development mode?
Sorry for my ignorance, what do you mean by development mode?
In your
config.php
file, sethttps://docs.grabaperch.com/docs/installing-perch/configuration/perch/
Interesting. I dropped that into the config file, and it seems to work now. What does this mean? Is there a course of action I should take? Does setting this disable caching?
That setting disabled caching. It sounds like a caching bug, and I'll look into it.
Hey there, just thought I'd put it out there that I updated to perch 2.6 and this issue hasn't changed. Perhaps it is a blog update issue??
Yes, the code is in Blog. We're working on an update for that.