Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #35101, comment 6


Ignore:
Timestamp:
12/22/2015 12:01:45 AM (9 years ago)
Author:
wetapplemedia
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35101, comment 6

    v1 v2  
    55
    66I have the exact problem and can confirm. If you set the option in an edit post, it sticks to whatever you last set it to no matter what the default is set to. I have code in my custom theme to set the defaults, and they appear to be set correctly in the options.php which doesn't change. However, any new posts or edited posts have it set to whatever it was changed to in the last edit.
     7
     8Here is my code from the functions.php file:
     9
     10{{{#!php
     11<?php
     12/**
     13 * Set the Attachment Display Settings "Link To" default
     14 *
     15 * This function is attached to the 'after_setup_theme' action hook.
     16 */
     17function default_attachment_display_settings() {
     18        update_option( 'image_default_align', 'right' );
     19        update_option( 'image_default_link_type', 'file' );
     20        update_option( 'image_default_size', 'medium' );
     21}
     22add_action( 'after_setup_theme', 'default_attachment_display_settings' );
     23}}}
     24
     25Indeed, neither "image_default_link_type" nor "image_default_align" nor "image_default_size" are defaulting correctly, but are always set (in edit pages) to whatever it was last changed to.
     26
     27