On Install, which code sets the ‘home’ option?

When the installer runs it calls wp_install(), that in turn calls populate_options() defined in wp-admin/includes/schema.php, which runs the following.. if ( !__get_option(‘home’) ) update_option(‘home’, $guessurl); Prior to that $guessurl is defined by.. $guessurl = wp_guess_url(); The guess URL function is defined in wp-includes/functions.php and looks like this. function wp_guess_url() { if ( defined(‘WP_SITEURL’) && ” … Read more

Which WordPress option stores the current active theme?

All those options are actually pointing to the active theme, but the difference is the value stored in each option: The options template and stylesheet both store the name of the active theme folder, e.g. twentytwentyone for the Twenty Twenty-One theme. But if you’re using a child theme, then stylesheet would be the name of … Read more

How to change the file upload directory on version 3.5?

In addition to what Joseph suggested, you can also define the upload path in the wp-config.php file like this: define( ‘UPLOADS’, ‘wp-content/’.’files’ ); If you’d like it outside the wp-content folder, specify path like this: define( ‘UPLOADS’, ”.’uploads’ ); For uploading to a folder like example.com/images, use this code: //Custom upload path define( ‘UPLOADS’, ”.’images’ … Read more

Settings API – how to update options manually?

That’s because your options are stored as a serialised array, in one row with name XX_theme_settings. To update one option, you would still need to retrieve the existing settings, ammend the appropriate value and update all options in your array together. For example: $my_options= get_option(‘XX_theme_settings’);//retrieve all options $my_options[‘XX_Option2’] = ‘my new value’; //amend value in … Read more

Add a custom option to a page in backend

To add a option box for a page or post, you need to use add_meta_boxes action. //Register Meta Box function register_meta_box() { add_meta_box( ‘meta-box-id’, __( ‘MetaBox Title’, ‘text-domain’ ), ‘meta_box_callback’, ‘post’, ‘advanced’, ‘high’ ); } add_action( ‘add_meta_boxes’, ‘register_meta_box’); //Add field function meta_box_callback( $post_id ) { $output=”<label for=”title_field”>”. esc_html__(‘Title Field’, ‘text-domain’) .'</label>’; $title_field = get_post_meta( $post_id->ID, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)