You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.
If you have a Post field in a block and have previously selected a post and saved then later on if you delete the post title out of the field and resave then on the front end it shows the latest post. The expected behavior is that it does not.
Steps to reproduce
Test 1
Add Post field to a block, select a Post Type you know has several options and use that block on a page. In the page editor, leave the field blank. Save/publish page.
Result: Nothing is shown for the Post field which is correct.
Test 2
Add Post field to a block, select a Post Type you know has several options and use that block on a page. In the page eidtor, click the Post field and select a post that is NOT the most recent. Save/publish page.
Result: You see the post you selected which is correct.
Test 3
Repeat test 2 but after saving the page delete the contents from the Posts field. Save/publish page.
Result: You are shown the latest post which is incorrect. It should show nothing as it did in Test 1.
Expected behavior
Deleting the post value should mean the field resets back to the starting state which is blank and results in no post being displayed on the front end.
Actual behavior
Deleting the post value leads to it displaying the latest post for that Post Type.
Use Case
We're using multiple Post fields in conjuction with standard text fields. The idea is that the user can either choose from existing posts (of multiple post types) via one of the Post fields or they can enter a custom title, description etc.
On the front end we have a conditional that checks if any of the Post fields are set and if not it uses the custom data. Because the previously set post field is not being reset properly then later Post fields or the custom data are not being displayed.
We loop through the fields like this:
foreach ($post_types as $post_type) {
if ($post_data = block_sub_value($post_type)) {
echo build_card($post_type, $post_data->ID);
break;
}
}
The first Post field it finds with a value is used and then we break out of the loop.
A real world example of the bug is that if you run Test 3 with the "Pages" field and then select a Article then you do not see the Article on the front end because it sees that the "Pages" field is not empty and so displays the latest Page instead of the selected Article.
This bug is rearing it's head when the customer goes in to edit an existing page to update one of the posts that is linked from it.
The only work-around we have for this is to delete the block and add it again which is quite frustrating when it's used in a long repeater with items in a specific order. Bad experience for our customer.
The text was updated successfully, but these errors were encountered:
Bug summary
If you have a Post field in a block and have previously selected a post and saved then later on if you delete the post title out of the field and resave then on the front end it shows the latest post. The expected behavior is that it does not.
Steps to reproduce
Test 1
Add Post field to a block, select a Post Type you know has several options and use that block on a page. In the page editor, leave the field blank. Save/publish page.
Result: Nothing is shown for the Post field which is correct.
Test 2
Add Post field to a block, select a Post Type you know has several options and use that block on a page. In the page eidtor, click the Post field and select a post that is NOT the most recent. Save/publish page.
Result: You see the post you selected which is correct.
Test 3
Repeat test 2 but after saving the page delete the contents from the Posts field. Save/publish page.
Result: You are shown the latest post which is incorrect. It should show nothing as it did in Test 1.
Expected behavior
Deleting the post value should mean the field resets back to the starting state which is blank and results in no post being displayed on the front end.
Actual behavior
Deleting the post value leads to it displaying the latest post for that Post Type.
Use Case
We're using multiple Post fields in conjuction with standard text fields. The idea is that the user can either choose from existing posts (of multiple post types) via one of the Post fields or they can enter a custom title, description etc.
Here is an image showing our block setup: https://i.imgur.com/4mX7uH6.jpg
On the front end we have a conditional that checks if any of the Post fields are set and if not it uses the custom data. Because the previously set post field is not being reset properly then later Post fields or the custom data are not being displayed.
We loop through the fields like this:
The first Post field it finds with a value is used and then we break out of the loop.
A real world example of the bug is that if you run Test 3 with the "Pages" field and then select a Article then you do not see the Article on the front end because it sees that the "Pages" field is not empty and so displays the latest Page instead of the selected Article.
This bug is rearing it's head when the customer goes in to edit an existing page to update one of the posts that is linked from it.
The only work-around we have for this is to delete the block and add it again which is quite frustrating when it's used in a long repeater with items in a specific order. Bad experience for our customer.
The text was updated successfully, but these errors were encountered: