Overriding Parent Functions from a Child Theme

There is a great post, albeit a bit old (2015) on tutsplus.com about overriding parent functions:

A Guide to Overriding Parent Theme Functions in Your Child Theme

Here is my tl;dr version:

  1. Even when using a Child Theme, all of your Parent Theme functions will still run.
  2. The functions in your child theme will be loaded before the functions in the parent theme.
  3. Priority is very important. Higher priority wins.
  4. If you are simply removing an action or filter, you need to do it from inside a function because that will ensure it runs AFTER the parent one has run.

As someone who often edits other people’s themes, these are very useful tools to know!


Comments

Leave a Reply

%d