6.1.3 and 6.1.6

Noticed this in 6.1.3 and just updated to 6.1.6 and the issue persists:

Consuming content on a single post type without a dedicated provider breaks. This used to work flawlessly in 5.1.5. Simply setting consume would automatically consume whatever the single post type was.

The odd part is that everything shows perfectly on the backend:

But is rendered blank on the front end:
Screen Shot 2023-03-07 at 10.27.33 AM

So to get this working again I had to setup an individual provider / consumer pair for each individual line item in that ā€˜Course Detail’ div whereas before each text field with data was simply a consumer.

Additionally, a separate issue, I noticed that if a consumer returns a numeric zero ā€œ0ā€ as in the third line (Questions) from the example screenshot above. It breaks and does not display but it works if it is anything other than 0.


Screen Shot 2023-03-07 at 10.52.01 AM

I’m not entirely sure what it’s consuming on single post type. Are you looping through fields of the post or post meta? I think a screenshot or tco would help me. And if it’s only not working on the frontend that shouldn’t be too bad of a fix.

The zero problem sounds like an empty problem. When you place type="json" on that zero problem one what does it output? If it’s null I can add a dynamic content type that forces a numeric output. I’m still a little confused on the setup.

Hi @charlie! Thanks for the response.

  1. Each one of those is simply consuming a custom field for example: {{dc:acf:post_field field=ā€œproduct_idā€}}. There were no providers set up as the entire single post data was the provider. Also, yes, it’s simply a front-end thing.

  2. When I place type=ā€œjsonā€ it outputs []

Screen Shot 2023-03-09 at 3.10.24 PM

1 Like
  1. Okay I see what you mean now. I’ll have a fix for that if it’s supposed to be returning the post, it is doing that in the preview just fine for me too, but not in the frontend. That’s cool I didn’t know you could have a consumer on a single type. This is what you are referring to right just to double check? I’m pretty sure on a single the context is always the post your working on though right?

image

  1. Is that questions field an array field? If not, what kind of field is it? when you go back into the post editor in the WordPress and save does it fix it?

Thanks @charlie!

  1. Yes, that is what I’m referring to. Aren’t consumers on the single post type exactly how it is intended to work? If I have a blog post template that I am working on and I want a headline element H1 to be the title I would set it as a consumer and set it’s dynamic content to post title. Then it automatically consumes the post title of the current post you are working on. Right?

In my case, that’s exactly what I was doing for some ACF fields that were added to the single custom post but they weren’t displaying when consumed. They had been for about a year in previous versions.

To break it down further. The structure was pretty basic:

Working on a single post template we had a row with two columns > a standard div in column two > a row inside of the div > with two column setup > left column was a fixed headline (not dynamic) > right column was a dynamic headline set to consumer with the dynamic content field set to mtcn_quiz_questions.

No provider. No multi-level consumers. Just a consumer on a single post for an acf field.

  1. The questions field is a simple number field within ACF. Nothing fancy.

Not sure if this is the same. In one of the Woo sites I have updated I had issues with consumers of the single product layout.

In Pro 5 I needed to have a consumer which I set on a row.

In Pro 6 this worked in the preview but on the front-end I had an empty space for everything in the row. After removing the consumer from the row then everything displayed correctly on both the preview and the front-end.

With Woo it seems like on singles it doesn’t like a consumer being set.

  1. If it was working this way in 5 I doubt it was intentional to remove. I think the difference in Pro6 is that you don’t need a consumer for a single type. Your example might not work removing the consumer, because you are using looper dynamic content variables, but it might when you use {{dc:post}} directly. I already wrote the code so I’m fine with fixing it so default consumers on a single type will just consume the only post they have.

The reason it does work in the preview is because loopers will output a result even if there are none, just so you can edit the styling. Technically there were no results, but it did have access to the data.

@urchindesign The issue you described is very similar if not the same.

  1. Hmm, did going back to the WordPress page editor and updating the acf field again do anything? Might be related to #1 as well.