Skip Navigation

[Resolved] Layout cache

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a Form displayed on a parent post. The Form creates child posts. There is a View of child posts displayed on the parent post as well. After creating a child post and refreshing the page, the new post does not appear in the View. I cannot see the new child post until I update the parent post Layout.

Solution: This appears to be an issue with the Redis Cache plugin.

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by cristianP-3 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1081527

I am trying to:
build a layout for post type with views and cred form inside.

Link to a page where the issue can be seen:
hidden link

I expected to see:
when I upload an image I can't see it after page refresh. If I make some changes to the layout of the post type then I can see the new image.

More info:
I have a post type with a layout. In this layout I have a cred to upload images and a view to show the images.
If a upload an image a hook make a relationship whit this post type and the image itself. The view is set to show me the images related to this post type. Before the upload I see the images already uploaded, after the upload I continue to see only the already uploaded images.
To show all the images (the old and the new one) I must make some change to the layout in admin and save it.
Now If I go to the page with a browser I can finally see all the images.

I think the problem is related to the cache but the shortcode view has the oprion cahced="off" activated.

Instead, I got:
I see always the old images

#1081613

Hi, I'll be glad to help.
when I upload an image I can't see it after page refresh
In this layout I have a cred to upload images and a view to show the images.
- Are these featured images or a custom field images?
- How are the images displayed in the View? Please copy any shortcodes you have used here for me to review.

If a upload an image a hook make a relationship whit this post type and the image itself.
- Can you share the hook code so I can see how this relationship is set up?

#1081662

Yes it's a featured image but it's the featured image of the post-type "image" that will be created!

This is the code that I use in the view -> content model:

This is the code that I use for the relationship (sorry for the first part.... just some operations for the post_type)

/********************************/
$local_timestamp = time();
$post = get_post($post_id);

$author_query = array(
'posts_per_page' => '1',
'author' => $post->post_author,
'post_type'=> array('artist','organizer')
);
$author_post = new WP_Query($author_query);

$title = sanitize_title( 'image_' . $author_post->posts[0]->ID . '_' . $local_timestamp );

wp_update_post(
array (
'ID' => $post_id,
'post_title' => $title,
'post_name' => $title
)
);

if($author_post->posts[0]->post_type == 'artist') {
toolset_connect_posts( 'artist-image', $author_post->posts[0]->ID, $post_id );
} elseif($author_post->posts[0]->post_type == 'organizer') {
toolset_connect_posts( 'organizer-image', $author_post->posts[0]->ID, $post_id );
}

/***********************************/

The last condition is the condition that build the relation between the post_type "organizer" and the post_type "image".

#1081687

I assume this code is in a cred_save_data hook, correct? I don't see any obvious problems here. It does seem likely that there is a caching issue. Please temporarily deactivate these cache-related plugins and test again:
- WP Fastest Cache
- Redis Object Cache
- Nginx Helper
- Jetpack

Is the new image shown when the page refreshes?
- If yes, reactivate the cache plugins one by one until the problem returns.
- If no, the next step is to test with only Types, Views, Layouts, and Forms active, and activate a default theme like Twenty Seventeen.

Is the new image shown now when the page refreshes?
- If yes, reactivate your theme and other plugins one by one until the problem returns.
- If no, I'll need to take a closer look.

#1082779

Thank you, the problem was the redis object cache plugin.
Disabled the redis plugin all works fine.
Thank you!