unable to create new PostGrids – PostQuery not saved
-
When creating a new postgrid, the “Query Post” shows as normal, withe Post TYpes, and able to select from Categories and Tags. After saving, the PostQuery fields show as blank,
e.g. If Post types was set to “post”, and Categories to “Foo”, aftr save/publish, and then open the grid edit page, the Post types will show blank, and the Post taxonomies and terms does not show anything, nor ability to select categories. Only “Please choose at least one post types. save/update post grid. Select post categories & terms.”. But no ability to select this.
If trying to view the grid on a page, it doesn’t have any items as it doesn’t seem to have saved the query.
Same behaviour if duplicating a grid.
-
Hi @quickdry,
We think you are using an older version of PHP (7.4 or older). The older version has some limitations, so we strongly advise users to update to PHP version 8.1 or higher. You can contact your hosting provider to update your PHP version.Please let us know if the issue has been fixed by updating the PHP version.
I found what seems to be the issue in the plugin output, it is odd data in the post_grid_meta_options value stored.
In a ‘healthy’ old grid, an example value is:
a:37:{s:11:"current_tab";s:7:"layouts";s:9:"grid_type";s:4:"grid";s:16:"lazy_load_enable";s:3:"yes";s:19:"lazy_load_image_src";s:93:"https://site_name_removed.com/wp-content/plugins/post-grid/assets/admin/gif/ajax-loader-1.gif";s:18:"lazy_load_alt_text";s:0:"";s:16:"load_fontawesome";s:2:"no";s:9:"container";a:3:{s:7:"padding";s:4:"10px";s:8:"bg_color";s:0:"";s:8:"bg_image";s:0:"";}s:13:"items_wrapper";a:1:{s:10:"text_align";s:6:"center";}s:10:"post_types";a:1:{i:0;s:4:"post";}s:10:"taxonomies";a:3:{s:8:"category";a:3:{s:7:"checked";s:8:"category";s:5:"terms";a:1:{i:0;s:3:"478";}s:14:"terms_relation";s:2:"IN";}s:8:"post_tag";a:3:{s:7:"checked";s:8:"post_tag";s:5:"terms";a:1:{i:0;s:2:"19";}s:14:"terms_relation";s:2:"IN";}s:11:"post_format";a:1:{s:14:"terms_relation";s:2:"IN";}}s:19:"categories_relation";s:3:"AND";s:11:"post_status";a:1:{i:0;s:7:"publish";}s:11:"query_order";s:3:"ASC";s:13:"query_orderby";a:1:{i:0;s:5:"title";}s:22:"query_orderby_meta_key";s:0:"";s:14:"posts_per_page";s:2:"-1";s:6:"offset";s:0:"";s:12:"ignore_paged";s:2:"no";s:15:"exclude_post_id";s:0:"";s:15:"include_post_id";s:0:"";s:7:"keyword";s:0:"";s:12:"no_post_text";s:0:"";s:5:"width";a:3:{s:7:"desktop";s:5:"200px";s:6:"tablet";s:5:"200px";s:6:"mobile";s:3:"90%";}s:9:"layout_id";s:4:"9409";s:11:"item_height";a:6:{s:5:"style";s:11:"auto_height";s:12:"fixed_height";s:5:"220px";s:12:"style_tablet";s:11:"auto_height";s:19:"fixed_height_tablet";s:5:"220px";s:12:"style_mobile";s:11:"auto_height";s:19:"fixed_height_mobile";s:5:"220px";}s:19:"items_bg_color_type";s:5:"fixed";s:14:"items_bg_color";s:4:"#fff";s:6:"margin";s:4:"10px";s:12:"item_padding";s:3:"0px";s:9:"justified";a:3:{s:7:"columns";a:3:{s:7:"desktop";s:1:"3";s:6:"tablet";s:1:"2";s:6:"mobile";s:1:"1";}s:6:"gutter";s:2:"20";s:9:"maxHeight";s:3:"180";}s:7:"masonry";a:2:{s:7:"columns";a:3:{s:7:"desktop";s:1:"3";s:6:"tablet";s:1:"2";s:6:"mobile";s:1:"1";}s:6:"gutter";s:2:"20";}s:5:"tiles";a:2:{s:7:"columns";a:3:{s:7:"desktop";s:1:"3";s:6:"tablet";s:1:"2";s:6:"mobile";s:1:"1";}s:6:"gutter";s:2:"20";}s:10:"nav_bottom";a:1:{s:15:"pagination_type";s:4:"none";}s:10:"pagination";a:7:{s:13:"max_num_pages";s:1:"0";s:9:"prev_text";s:11:"? Previous";s:9:"next_text";s:7:"Next ?";s:9:"font_size";s:4:"16px";s:10:"font_color";s:4:"#fff";s:8:"bg_color";s:7:"#646464";s:15:"active_bg_color";s:7:"#4b4b4b";}s:9:"custom_js";s:0:"";s:10:"custom_css";s:0:"";s:7:"nav_top";a:7:{s:11:"action_type";s:4:"ajax";s:6:"search";s:2:"no";s:18:"search_placeholder";s:12:"Start typing";s:11:"search_icon";s:29:"<i class="fas fa-search"></i>";s:19:"search_loading_icon";s:38:"<i class="fas fa-spinner fa-spin"></i>";s:11:"query_order";s:4:"DESC";s:13:"query_orderby";a:1:{i:0;s:4:"date";}}}
But in a broken output that I’m getting recently, the value stored in post_griod_meta_options is:
a:37:{s:11:"current_tab";s:10:"query_post";s:9:"grid_type";s:4:"grid";s:16:"lazy_load_enable";s:3:"yes";s:19:"lazy_load_image_src";s:93:"https://site_name_removed.com/wp-content/plugins/post-grid/assets/admin/gif/ajax-loader-1.gif";s:18:"lazy_load_alt_text";s:0:"";s:16:"load_fontawesome";s:2:"no";s:9:"container";a:3:{s:7:"padding";s:4:"10px";s:8:"bg_color";s:0:"";s:8:"bg_image";s:0:"";}s:13:"items_wrapper";a:1:{s:10:"text_align";s:6:"center";}s:10:"post_types";a:1:{i:0;s:11:"https://post";}s:10:"taxonomies";a:3:{s:8:"category";a:3:{s:7:"checked";s:8:"category";s:5:"terms";a:1:{i:0;s:10:"https://461";}s:14:"terms_relation";s:2:"IN";}s:8:"post_tag";a:3:{s:7:"checked";s:8:"post_tag";s:5:"terms";a:1:{i:0;s:9:"https://19";}s:14:"terms_relation";s:2:"IN";}s:11:"post_format";a:1:{s:14:"terms_relation";s:2:"IN";}}s:19:"categories_relation";s:3:"AND";s:11:"post_status";a:1:{i:0;s:14:"https://publish";}s:11:"query_order";s:3:"ASC";s:13:"query_orderby";a:1:{i:0;s:12:"https://title";}s:22:"query_orderby_meta_key";s:0:"";s:14:"posts_per_page";s:2:"-1";s:6:"offset";s:0:"";s:12:"ignore_paged";s:2:"no";s:15:"exclude_post_id";s:0:"";s:15:"include_post_id";s:0:"";s:7:"keyword";s:0:"";s:12:"no_post_text";s:0:"";s:5:"width";a:3:{s:7:"desktop";s:5:"200px";s:6:"tablet";s:5:"200px";s:6:"mobile";s:3:"90%";}s:9:"layout_id";s:4:"9409";s:11:"item_height";a:6:{s:5:"style";s:11:"auto_height";s:12:"fixed_height";s:5:"220px";s:12:"style_tablet";s:11:"auto_height";s:19:"fixed_height_tablet";s:5:"220px";s:12:"style_mobile";s:11:"auto_height";s:19:"fixed_height_mobile";s:5:"220px";}s:19:"items_bg_color_type";s:5:"fixed";s:14:"items_bg_color";s:4:"#fff";s:6:"margin";s:4:"10px";s:12:"item_padding";s:3:"0px";s:9:"justified";a:3:{s:7:"columns";a:3:{s:7:"desktop";s:1:"3";s:6:"tablet";s:1:"2";s:6:"mobile";s:1:"1";}s:6:"gutter";s:2:"20";s:9:"maxHeight";s:3:"180";}s:7:"masonry";a:2:{s:7:"columns";a:3:{s:7:"desktop";s:1:"3";s:6:"tablet";s:1:"2";s:6:"mobile";s:1:"1";}s:6:"gutter";s:2:"20";}s:5:"tiles";a:2:{s:7:"columns";a:3:{s:7:"desktop";s:1:"3";s:6:"tablet";s:1:"2";s:6:"mobile";s:1:"1";}s:6:"gutter";s:2:"20";}s:10:"nav_bottom";a:1:{s:15:"pagination_type";s:4:"none";}s:10:"pagination";a:7:{s:13:"max_num_pages";s:1:"0";s:9:"prev_text";s:11:"? Previous";s:9:"next_text";s:7:"Next ?";s:9:"font_size";s:4:"16px";s:10:"font_color";s:4:"#fff";s:8:"bg_color";s:7:"#646464";s:15:"active_bg_color";s:7:"#4b4b4b";}s:9:"custom_js";s:0:"";s:10:"custom_css";s:0:"";s:7:"nav_top";a:7:{s:11:"action_type";s:4:"ajax";s:6:"search";s:2:"no";s:18:"search_placeholder";s:12:"Start typing";s:11:"search_icon";s:29:"<i class="fas fa-search"></i>";s:19:"search_loading_icon";s:38:"<i class="fas fa-spinner fa-spin"></i>";s:11:"query_order";s:4:"DESC";s:13:"query_orderby";a:1:{i:0;s:11:"https://date";}}}
The only differences in these grid definitions should be the “term” 478 in the first, 461 in the second. But you can see lots of “https://” added in values, e.g. instead of term 461, it has https://461, it is most easiest to see on the query_order_by (last value in both) being “date” in the working grid, and “https://date” in the second.
If I go into MySQL and manually remove those erroneous “https://” from the value, then everything works. But the next grid I define does the same thing, whether a new grid, or a duplicated grid from a working grid. The issue crops up when using the save/update. Have tested on safari, chrome, firefox in case of suden browser weirdness.
Is there some weird escaping going on? it is in all user selected values e.g. post_type, category, terms, post_status, query_orderby
thanks for the reply, it came in while I was replying above. Yes, it is PHP 7.4 and switching to v 8.1 seems to have fixed the problem. Thanks.
I couldn’t see any PHP version requirement changes (the plugin page says 7.3 – might be worth adding a note to it. I’m not sure if what I posted might help for building in some error checking. It’s an awesome plugin, I really appreciate it.
- You must be logged in to reply to this topic.