View Single Post
  #1 (permalink)  
Old March 18th, 2015, 12:52 PM
Sausage Sausage is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 3 - Hooks within a class. add_action

Hi, I am new to all of this, but not new to coding or software engineering. I have to agree with the books opening comments - "It can be a challenge to find resources in a single place". Hence I am reading this book.

Background to my question:
On page 31 add_action is define as taking 4 parameters. The second parameter is "$function" - "The name of your function that wordpress calls".

My question: Using Hooks from within a class uses the following example:

<? php
add_action ( $tag ,$function_to_add );

So why is the example using the $function_to_add - this is core wordpress function and an alias for "add_filter()".

Is there something I do not understand, or was this just an accident that the example on page 51 calls core functionality when it should be referring to my own function that "I want to add"?

Reply With Quote