WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Plugin API/Filter Reference/enable post format ui"

(Remove post format UI: use __return_false callback)
Line 25: Line 25:
 
=== Remove post format UI ===
 
=== Remove post format UI ===
 
<pre>
 
<pre>
add_filter( 'enable_post_format_ui', 'filter_function_name', 10, 2 );
+
add_filter( 'enable_post_format_ui', '__return_false', 10, 2 );
 
function filter_function_name( $enabled, $post) {
 
return false;
 
}
 
 
</pre>
 
</pre>
   

Revision as of 22:22, 28 May 2013

Description

The enable_post_format_ui filter allows developers and themers to turn off the post format UI on the new post page of wp-admin.

Usage

When the 'enable_post_format_ui' filter is called, it is passed two parameters:

  • $enabled - Boolean value to show post format UI
  • $post - WP_Post object related to current post
add_filter( 'enable_post_format_ui', 'filter_function_name', 10, 2 );

function filter_function_name( $enabled, $post) {
    return $enabled;
}

Where 'filter_function_name' is the function WordPress should call when filter is run. Note that the filter function must return an value after it is finished processing or the result will be empty.

filter_function_name should be unique function name. It cannot match any other function name already declared.

Examples

Remove post format UI

add_filter( 'enable_post_format_ui', '__return_false', 10, 2 );

Change Log

See Also