PHP/WordPress: Why is this echo always loading in the same spot no matter what?

I am extending someone else’s plugin. He has an action hook in the function he uses to initialize the plugin. It doesn’t matter if I put echo nl2br("this is located OVER the do action anspress loaded. n"); BELOW or ABOVE the line do_action('anspress_loaded'); – the line always get’s echo’d out ABOVE another line I have being echo’d inside the other code loaded on that hook. Why is this? It’s probably not TREMENDOUSLY important but I’m just curious….(noob here). Any idea?

this initializes the plugin

Read More
        /**
         * Initializes the plugin by setting localization, hooks, filters, and administrative functions.
         *
         * @return instance
         */
        public static function instance() {

            if ( ! isset( self::$instance ) && ! (self::$instance instanceof self) ) {
                self::$instance = new self();
                self::$instance->setup_constants();
                self::$instance->actions = array();
                self::$instance->filters = array();

                add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );

                add_action( 'bp_loaded', array( self::$instance, 'bp_include' ) );

                global $ap_classes;
                $ap_classes = array();

                self::$instance->includes();

                self::$instance->ajax_hooks();
                self::$instance->site_include();

                self::$instance->anspress_forms         = new AnsPress_Process_Form();
                self::$instance->anspress_query_filter  = new AnsPress_Query_Filter();
                self::$instance->anspress_cpt           = new AnsPress_PostTypes();
                self::$instance->anspress_reputation    = new AP_Reputation();

                /*
                 * ACTION: anspress_loaded
                 * Hooks for extension to load their codes after AnsPress is leaded
                 */
                echo nl2br("this is located OVER the do action anspress loaded. n");
                do_action('anspress_loaded');


                self::$instance->setup_hooks();
            }

            return self::$instance;
        }

this might be important:

        /**
         * Register the filters and actions with WordPress.
         */
        private function setup_hooks() {
            foreach ( $this->filters as $hook ) {
                add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
            }

            foreach ( $this->actions as $hook ) {
                add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
            }
        }

Related posts