Skip Navigation

[Résolu] Custom fields remain blank after publishing

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: When I try to save updates in custom posts, custom field values are not saving. They show up as blank.

Solution: There appears to be some database corruption here. Try repairing the wp_postmeta table after making a full backup.

This support ticket is created Il y a 5 années et 6 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 12 réponses, a 2 voix.

Dernière mise à jour par indianplayschools Il y a 5 années et 5 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1245358

I have tried entering the custom field values in the new custom post. After entering, when I click publish, they are not displayed. All the custom fields are blank.
The previously added custom posts are displaying the custom fields. The problem is only with the new custom posts added from admin or added by the user from front end using CRED forms. I deactivated all the plugins except toolset plugins, But, the problem persists.
Please let me know the solution

#1245461

Hi, please temporarily activate a default theme like Twenty Nineteen, then deactivate all plugins except Types. Test again. If the problem is not resolved, let's try to get some additional information from the server logs. If you're not familiar with server logs, I can show you how to activate them temporarily. Go in your wp-config.php file and look for

define('WP_DEBUG', false);

Change it to:

define('WP_DEBUG', true);

Then add these lines, just before it says 'stop editing here':

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

Save the file and upload it to your server. Then try to modify the custom field values in a custom post. If any server-side errors are thrown, this will create an error_log.txt file in your site's root directory. Please send me its contents. Once that is done, you can revert the changes you made to wp-config.php and delete the log file.

Please let me know what you find from these tests and we can go from there.

#1245595
Capture.JPG

Thanks for your reply.
I tried doing what you have metioned. After changing the theme also, the problem persists. So, I changed the wp-config.php file as indicated by you. When I save the file and open the website, I get an error saying the page isn't working.
Please let me know my next step.
I have reverted back all the changes so that website works as before.
Thanks to you.

#1246060

I can try to make a copy of your site using the All-in-One WP Migration plugin that is already installed on your site. This will allow me to run tests without causing any problems on your live site. I'll let you know what I find out, I'm working on this now.

#1246075

Thanks a lot!

#1246080
number.png

When I tried to make a full site clone. I saw this error:
Out of disk space. Unable to write content to file. File: /***/***/***/wp-content/plugins/all-in-one-wp-migration/storage/n8jx6094k257/indianplayschools.com-20190520-162011-592.wpress

I changed the configurations to exclude image uploads, and that solved the problem and I could create a smaller site clone. However, please be aware that you may be close to reaching your hosting disc space limits and you should check with your host.

Then I installed the cloned site locally, deactivated all plugins except Types and Views, and edited a Preschool post. I was able to save the custom field successfully (see number.png). So something is different between my local environment and yours. The first thing that comes to mind is caching. I can see a few caching plugins in your plugins and mu-plugins directories. As a test, please temporarily disable those cache systems and test again.

The next thing to test is your server's php MaxInputVars setting. Yours is currently set at 1000. Try increasing this to 2000. You may need assistance from your hosting provider to set this value.

Finally, check your MySQL database size and the size limits from your host.

If none of these seems to solve or point to the problem, I'll need to check your wp-config.php file to see your other configurations.

#1246190

Thank you so much for the detailed explanation.
I request you to let me know which plugins have to be deactivated.
I tried changing the php_value max_input_vars to 2000. it is showing an error. I will contact my hosting personal for this.
I also found an error file in the database
WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))) AND wp_posts.post_type = 'preschool' AND ((wp_posts.post_status = 'publish'' at line 1 for query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND ((())) AND wp_posts.post_type = 'preschool' AND ((wp_posts.post_status = 'publish')) ORDER BY wp_posts.post_date DESC LIMIT 1605, 5 made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

Hope this makes it more clear.
Thank you

#1246540

I'm just looking through your site files for obvious caching references. This file:
- /wp-content/wp-cache-config.php
It provides configuration for some kind of caching called WP-Cache Manager. I don't see that listed in your plugins directory, and if it's a server-side caching system I need you to disable it temporarily.

I'm not sure what this directory is used for, do you have any idea?
- /wp-content/widget-cache

This directory is created by Divi, and I don't think it's part of the issue. You can ignore it:
- /wp-content/cache/

#1246593

Please go ahead and make the changes that you feel will fix the problem. I am unaware of the back end coding.
Thanks a lot

#1246639

I need your FTP information to be able to inspect your wp-config.php file and other server conditions.

#1246695
#1246711

I'm looking at your error log file here:
/error_log
You can download the file using FTP. I can see starting May 16:
[16-May-2019 05:07:28 UTC] PHP Warning: mysqli_query(): MySQL server has gone away in /home/indianplayschool/public_html/wp-includes/wp-db.php on line 2007
[16-May-2019 05:07:27 UTC] PHP Warning: mysqli_query(): MySQL server has gone away in /home/indianplayscho[16-May-2019 05:56:57 UTC] WordPress database error Duplicate entry '586680' for key 'PRIMARY' for query INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (201426, 'et_enqueued_post_fonts', 'a:2:{s:6:\"family\";a:1:{s:15:\"et-gf-open-sans\";s:80:\"Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic\";}s:6:\"subset\";a:7:{i:0;s:8:\"cyrillic\";i:1;s:5:\"greek\";i:2;s:10:\"vietnamese\";i:3;s:5:\"latin\";i:4;s:9:\"greek-ext\";i:5;s:9:\"latin-ext\";i:6;s:12:\"cyrillic-ext\";}}') made by shutdown_action_hook, do_action('shutdown'), WP_Hook->do_action, WP_Hook->apply_filters, et_builder_update_fonts_cache, update_post_meta, update_metadata, add_metadata
[16-May-2019 06:08:32 UTC] WordPress database error Duplicate entry '586680' for key 'PRIMARY' for query INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) VALUES (221343, '_wp_page_template', 'default') made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/Divi/page.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, ET_Builder_Element->_shortcode_callback, ET_Builder_Section->shortcode_callback, do_shortcode, preg_replace_callback, do_shortcode_tag, ET_Builder_Element->_shortcode_callback, ET_Builder_Row->shortcode_callback, do_shortcode, preg_replace_callback, do_shortcode_tag, ET_Builder_Element->_shortcode_callback, ET_Builder_Column->shortcode_callback, do_shortcode, preg_replace_callback, do_shortcode_tag, ET_Builder_Element->_shortcode_callback, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->create_new_post, cred__create_auto_draft, wp_insert_post, update_post_meta, update_metadata, add_metadata

After this there are several hundred messages about duplicate entry '586680' for key 'PRIMARY' in wp_postmeta. This typically indicates some type of database corruption. You should make a backup of your database first, then try to repair the table using phpMyAdmin or your host's control panel. You may want to get your host involved so they are aware of the problem and can guide you to the necessary tools to fix it.

Look at this other ticket. I just did a search of the forums and it seems this is a recurring issue on your site:
https://toolset.com/forums/topic/custom-field-entries-are-lost-when-i-update-the-listing/

#1246900

Thanks a lot. This worked. I repaired my database and everything is working fine. Thank you for your detailed explanation and in depth knowldege. Being a complete non-coder, this plugin and the associated support system have made me develop my website. Thanks a lot.

#1246902

My issue is resolved now. Thank you!