[AUTOMATIQUE] Cet article a plus de 5 ans.
Il se peut donc que les informations qu'il fournit ne soient plus totalement exactes.

Here is a small tip to let you disable some post formats within your child theme.
The hook must be attached to the after_setup_theme event.

At first I used the init event but it is not a good practice because it overrides every potential clean function which may used this hook without considering priority.

The init event is not the “magical” solution, it is the slacker’ one :p

function bweb_remove_post_formats() {
	add_theme_support( 'post-formats', array( 'link', 'audio', 'status' ) );
}
add_action( 'after_setup_theme', 'bweb_remove_post_formats', 11 );

Note that the hook priority is set to 11, it is the lowest you can use to make this hook works properly.

As a reminder, here is the default supported post formats :

  • default (obviously, it can’t be disable)
  • aside
  • gallery
  • link
  • image
  • quote
  • status
  • video
  • audio
  • chat

If you want to disable all the list at once, simpy use remove_theme_support(‘post-formats’)

Post written byBrice CAPOBIANCO

WordPress addict and self-taught. I love to learn and to create, then to share…
Founder of bweb.
Share this post

Your email address will not be published. Required fields are marked *