Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

Reply To: Set a page template to use sections?

Home Forums Support Set a page template to use sections? Reply To: Set a page template to use sections?

#187144
Katie Jones

Got it! It was that I needed to use an array and let WP serialize it, instead of this string. This works!

function zs_set_sections($post_id, $post, $update) {

  $template = get_post_meta($post_id, "_wp_page_template", true);
  if($template == "tmpl_landing.php") {
    add_post_meta($post_id, "_generate_use_sections", array("use_sections" => "true"), true);
  } 
    
}
add_action( 'save_post', 'zs_set_sections', 10000, 3 );
  • This reply was modified 4 years, 7 months ago by Tom.