My answer to this is not to continue down this path. It is a good idea to be able to choose a template
from the customizer, however, this code looks like it is attempting to save all page data as options and theme mods, and that is a bad idea.
-
Theme Mods are a single option row in the database, and specific to ONLY the theme you are using. Therefore, any data saved to it is lost to any other theme you may want to use in the future.
-
Options are single rows in a single table with limited columns and are not considered post data in WordPress, outside of this concept.
Selecting a page_template
or other post_meta
is available in the Customizer, as seen in a few plugins that are viable for this type of situation.
Related Posts:
- How do I remove a pre-existing customizer setting?
- Theme customizer – settings order
- Custom Image section in Customizer
- Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?
- Add a dropdown to theme customizer
- Allow Shortcode in Theme Customizer
- Theme Customizer – Nested Sections?
- Can I create customizer setting that can handle plugin shortcode?
- Editing the custom background CSS
- Is the theme customizer slowing down my site?
- WordPress Customize — Move “menus” options / field to another section
- Changing the entire control choices using wp.customize with JavaScript
- How to remove menus section from WordPress theme customizer
- Checking if there is an Image inserted – if not don’t display anything
- “Display Site Title and Tagline” checkbox not working?
- Default header image does not display
- Responsive Images – Generating multiple images from Theme Customizer control upload?
- Modify the Additional CSS section (adding a disclaimer)
- wordpress custom theme import and export options for sample data [closed]
- How to hook CSS file according to theme selection in the customizer section
- Change setting name in Customizer and keep the data
- after_setup_theme, Global Variable and Theme Customizer
- Custom Script Section Only Echoes Text
- WordPress not registering Theme Customization Section
- WP Customize refresh problem
- Get a setting value conditionally in the Customizer api
- How to add new args data in $wp_customize->add_setting?
- WP_Customize_Color_Control omitting # symbol
- Hide header texts (Title & Tagline) in custom-header.php
- get_option in header.php not returning value from customizer
- Internal error 500 accessing Theme > Customize
- Theme-wide custom post template
- Disabling Customizer Selective Refresh shortcut icons for selected controls
- JavaScript stops working on selectively refreshed sections one inside the other
- Folder name for a pro version of a WordPress.org theme?
- Display theme layouts [closed]
- Customizer: save setting/control content to post/page
- Dynamically generated wordpress customizer options?
- Is accessing theme and using customizer GPL distribution?
- How to disable wordpress from overload my stylesheet styles with customizer styles
- How to enqueue javascript for WP Customize options sidebar?
- Is it possible to visually group items on the theme customizer?
- Theme Customizer not loading JS for live preview
- Customizer – loading settings/controls/sections/panels based on a id/page id
- Change WordPress header color using customizer
- Default Text not showing from customizer
- Is there any way to register custom background images like header images?
- How to transfer one domain to another domain without losing theme options (customizer)?
- Theme Customizer not displaying saved values in wp_head (CSS)
- How to allow certain PHP functions when using sanitize_callback in the word press customizer
- Customizer Color Control Not Working
- where is real values of variables?
- How to allow users to create their own website within my domain? [closed]
- Doing context-aware previews in the WordPress Customizer
- How to set Post meta-box defaults based on the choices made by user in Customizer?
- Alignment Problem [closed]
- Avada Child Theme Development
- Questions from a new WP Dev [closed]
- Adding a new setting using Kirki or WP customizer with an if statement
- Theme customizer – can’t add section/settings
- add shortcode support in customizer
- Twenty Twelve Author not displaying
- How to set a custom URL for the iframe in the customize page
- How to add wysiwyg editor in customize screen using customize_register
- How to register dynamic settings in WordPress Customizer?
- How to copy page/post from one theme to another?
- How to change listing type permlink?
- In wordpress customizer div still showing even if I hid it with javascript
- How to enable admin to upload multiple images to support header carousel slider theme in WordPress?
- Removing element from DOM with jquery through plugin Custom Scripts for Customizer
- Why does wp_customizer default values do not apply when theme is installed for the first time?
- Customizer API Multi Sections in single Panel
- How Do I Create a WordPress Demo Site with Limited Admin Access
- Fatal error: Class WP_Customize_Image_Control not found
- What is difference between add_theme_support and Theme Customization API?
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- How do I remove header/page-title image in farvis theme? [closed]
- How to show Custom Field Value in Woocommerce Shop Page
- How to show some of category in wordpress
- Duplicate child theme incl. design changes
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- Is there a way to create sections under “Colors” panel in the Theme Customizer?
- Import settings from another theme
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Customizer Image-Picker Preview Not Working
- How to customize the colors within a stylesheet using a WordPress setting
- Correct was to customise theme using get_theme_mod in scripts
- How to get url image page the right way?
- How to create multiple customizer controls in one control
- Load get_page_templates into select menu
- WordPress Customizer Help with FontAwesome Icon
- WordPress Customization API overwrite LESS variable
- Customizer API way function is_customize_preview() works only in main page?
- “No Data Received” error in Chrome every time i try to update the theme functions file
- trying to figure out how to use more that one image upload in the same section in theme customizer
- How do I make it super customisable?
- My theme is full of error messages in the “Customize” screen, but nowhere else
- How to show associated fields if checkbox is checked in customize widget screen using wp_customize?
- WP Customizer get control value on change
- Execute javscript when theme customizer loads (autosave issue)