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


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: