Skip to main content
added 218 characters in body
Source Link
prosti
  • 4.3k
  • 4
  • 25
  • 45

I think you should be using something like this.

set_theme_mod. This will save the value to the database.

set_theme_mod('facebooklink_edit','aaabbbccc');
echo get_theme_mod('facebooklink_edit', 'default');

Also, toTo keep the theme setting only for your theme use type'type' => 'theme_mod'.

$wp_customize->add_setting( 'facebooklink_edit' , array(
    'type' => 'theme_mod', // only for this theme    
    'transport'   => 'refresh', 
    'default' => 'aaabbbccc'
    //'sanitize_callback' => 'someething...',
) );

The save() method exists inside class-wp-customize-manager() but it looks like not meant for using with JavaScript only.

You theme settings, in general, can be either 'theme_mod' or 'option'.

My proposal for you was to use theme_mod in this case.

I think you should be using something like this.

set_theme_mod will save the value to the database.

set_theme_mod('facebooklink_edit','aaabbbccc');
echo get_theme_mod('facebooklink_edit', 'default');

Also, to keep the theme setting only for your theme use type

$wp_customize->add_setting( 'facebooklink_edit' , array(
    'type' => 'theme_mod', // only for this theme    
    'transport'   => 'refresh', 
    'default' => 'aaabbbccc'
    //'sanitize_callback' => 'someething...',
) );

I think you should be using something like set_theme_mod. This will save the value to the database.

set_theme_mod('facebooklink_edit','aaabbbccc');

To keep the theme setting only for your theme use 'type' => 'theme_mod'.

$wp_customize->add_setting( 'facebooklink_edit' , array(
    'type' => 'theme_mod', // only for this theme    
    'transport'   => 'refresh', 
    'default' => 'aaabbbccc'
    //'sanitize_callback' => 'someething...',
) );

The save() method exists inside class-wp-customize-manager() but it looks like not meant for using with JavaScript only.

You theme settings, in general, can be either 'theme_mod' or 'option'.

My proposal for you was to use theme_mod in this case.

Source Link
prosti
  • 4.3k
  • 4
  • 25
  • 45

I think you should be using something like this.

set_theme_mod will save the value to the database.

set_theme_mod('facebooklink_edit','aaabbbccc');
echo get_theme_mod('facebooklink_edit', 'default');

Also, to keep the theme setting only for your theme use type

$wp_customize->add_setting( 'facebooklink_edit' , array(
    'type' => 'theme_mod', // only for this theme    
    'transport'   => 'refresh', 
    'default' => 'aaabbbccc'
    //'sanitize_callback' => 'someething...',
) );