register_editable_option() #57

Open
scribu opened this Issue Feb 19, 2012 · 1 comment

Projects

None yet

1 participant

@scribu
Owner
scribu commented Feb 19, 2012

Currently, all the details about editing a particular option need to be passed on ajax each request.

It would be safer and more efficient to register them beforehand and just pass the key. Here's how it would work:

First, call register_editable_option() in your functions.php file:

register_editable_option( array(
  'key' => 'whatever',
  'type' => 'rich',
  'default' => 'foobar'
) );

Then, in your template files, just pass the key:

<?php editable_option( 'whatever' ); ?>
@scribu
Owner
scribu commented Mar 11, 2012

On the other hand, having to register potentially dozens of options before using them can get tedious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment