• Hello,
    I have a problem: Every time I make changes to the SEO fields, the ACF fields, and Multiple content blocks on pages and try to click update, they won’t save (Basically, fields that are added through customisations).

    DETAILS:

    • I am just starting on making a theme, based on the starkers theme Blank slate (https://github.com/viewportindustries/starkers) and haven’t gone that far yet (functions.php code posted below).
    • I am running on Localhost via easyPHP
    • This problem is mostly Prevalent to Pages not posts (Posts save SEO details, thankfully).
    • Changes to the Body content for pages still save.
    • I am suspecting it’s something bad I did or something I haven’t included yet on my functions.php file— if there are any PHP experts here that could take a look, please, I’m begging your help. Here’s the full functions.php code:
      <?php
      require_once( 'external/starkers-utilities.php' );
      /* Theme settings */
      define('WT_DIR', get_template_directory_uri());
      define('WT_TEMPLATE_DIR', get_template_directory());
      add_theme_support('post-thumbnails');
      register_nav_menus(array('wt-prime-menu' => 'Main Menu'));
      function wt_nav() {
      wp_nav_menu( array('theme_location'=> 'wt-prime-menu','container'=> false,'menu_class'=> 'nav navbar-nav navbar-right'  ));
      }
      /* Actions and Filters */
      add_action( 'wp_enqueue_scripts', 'starkers_script_enqueuer' );
      add_filter( 'body_class', array( 'Starkers_Utilities', 'add_slug_to_body_class' ) );
      /* Custom Post Types */
      require_once( 'parts/cpt/cpt.php' );
      /* Enqueue Scripts */
      
      function starkers_script_enqueuer() {
      wp_register_script( 'site', WT_DIR.'/js/site.js', array( 'jquery' ) );
      wp_enqueue_script( 'site' );
      wp_register_style( 'screen', get_stylesheet_directory_uri().'/style.css', '', '', 'screen' );
      wp_enqueue_style( 'screen' );
      }
      function wt_scripts_and_styles() {
      wp_enqueue_style( 'bootstrap', WT_DIR . '/css/bootstrap.min.css' );
      wp_enqueue_style( 'whitetower', WT_DIR . '/css/wts.css' );
      wp_enqueue_style( 'googlefonts', 'https://fonts.googleapis.com/css?family=Roboto:500,400|Raleway:600,900|Montserrat:400,700' );
      wp_enqueue_script( 'bootstrap', WT_DIR . '/js/bootstrap.min.js', array(), '3.2.0', true );
      wp_enqueue_script( 'wtnav', WT_DIR . '/js/snav.js', array(), '1.0.0', true );
      wp_enqueue_script( 'flexslider', WT_DIR . '/js/flexslider.js', array(), '2.2.2', true );
      wp_enqueue_script( 'modernizr', WT_DIR . '/js/modernizr.js', array(), '2.7.1', true );
      wp_enqueue_script( 'googlefonts', WT_DIR . '/js/wt-webfonts.js', array(), '1.0.0', true );
      }
      add_action( 'wp_enqueue_scripts', 'wt_scripts_and_styles' );
      /* Comments */
      function starkers_comment( $comment, $args, $depth ) {
      $GLOBALS['comment'] = $comment;
      ?>
      <?php  if ( $comment->comment_approved == '1' ): ?>
      <li>
      <article id="comment-<?php  comment_ID()  ?>">
      <?php  echo get_avatar( $comment ); ?>
      <h4><?php  comment_author_link()  ?></h4>
      <time><a href="#comment-<?php  comment_ID()  ?>" pubdate><?php  comment_date()  ?> at <?php  comment_time()  ?></a></time>
      <?php  comment_text()  ?>
      </article>
      <?php
      endif;
      }
    • Workaround: For ACF (Custom Fields) Entering Custom fields details on the generic WP custom field works (which isolates the problem on customisations on the theme). BUT this does not help the problem with WP SEO.
    • Workaround: For WP SEO, I had to change to another theme (premium theme, Batakoo) edit the SEO, and the SEO saves just fine. Switching back to the theme I was building, the SEO fields become read-only again.
    • I can’t live on workarounds forever, I need fixes, so if anyone can help, please do.

    THINGS THAT I’VE TRIED

    Just to make sure we’re on the same page and no one has to comment solutions that I’ve tried, here are the things I’ve already tried (but did not work) based on searching WP.Org for solutions to “Fields don’t save on WordPress Pages”:

    • I’ve had the database tables repaired via PhpMyAdmin
    • Removed extra spaces and additional comments in functions.php
    • disabled all plugins except the ones I’m testing (SEO)
Viewing 1 replies (of 1 total)
  • Ok so I had the same issue and could not change any meta data on old published pages only new ones.

    So this fix worked for me…..

    The problem is the _wp_page_template in the wp_postmeta table. This was being saved to a previous themes template name.

    You can change the following line of code in wp-admin/includes/meta-boxes.php:

    if ( ‘page’ == $post->post_type && 0 != count( get_page_templates( $post ) ) ) {

    on line 742 to the following:

    if ( ‘page’ == $post->post_type ) {

    This will force the page attributes to display “Default Template”. When saving the page this will then update the value in the DB.

    The actual line which causes the problem is: $page_templates = wp_get_theme()->get_page_templates( $post ); which is in wp-includes/post.php. This returns blank and then fails to run update_post_meta();

    Hope this helps you.

Viewing 1 replies (of 1 total)
  • The topic ‘ACF Custom Fields, Yoast SEO, and others Not Saving’ is closed to new replies.