• Christina

    (@littlevictorian)


    I’m attempting to write my first plugin. How do you de-register a theme feature via a plugin?

    Obviously, putting remove_theme_support( 'custom-background' ); in the plugin file doesn’t work.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Christina,

    I wonder if it may have something to do with the setup code that’s usually wrapped around theme features, so for example:
    function twentyeleven_setup() {}

    I know your question asks specifically about plugins but have you tried overwriting theme features with a child theme?

    Moderator bcworkz

    (@bcworkz)

    remove_theme_support() should work if it’s executed at the right time. Plugins are loaded before themes, so executing this function when the plugin loads attempts to remove something that does not yet exist. Add an action callback to the ‘init’ action and try removing the support from there.

    Thread Starter Christina

    (@littlevictorian)

    Oooh, thank you bcworkz! I’ll try that.

    graphicscove, yes, it works fine when I add it directly to my themes. I was just hoping to build an optional plugin that could be used with any of my themes. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove theme support via plugin?’ is closed to new replies.