WordPress hooks to call a function inside a construct

I am trying to call a custom function inside the constructor function. Which action hook to be used?

class myClass{

  public function __construct(){

        add_action('$hook', array($this, myFunction);
  }

  public function myFunction(){
      echo "I am called";
   }
}

Additionally, I have two questions

  1. What would be the intention of private construct instead of public?
  2. Which one is better to use; singleton class or the normal call.

Looking forward

Thanks

Read more here: WordPress hooks to call a function inside a construct

Leave a Reply

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