FrontAction

Code is executed only when Wordpress is loaded and the front is requested. Action is instantiated by a Wordpress mu-plugins.

Please not that you may need to use init or loaded function depending of the context of the action to run.

Init function run early and Wordpress configuration file is not yet loaded completely.

<?php

// src/Action/FrontAction.php

namespace App\Action;

use Metabolism\WordpressBundle\Action\FrontAction as BaseFrontAction;

class FrontAction extends BaseFrontAction
{
	/**
	 * Equivalent to if( !is_admin() ) add_action('init', function(){ })
	 */
	public function init()
	{
		//add_action
	}
	
	/**
	 * Equivalent to KernelEventsSubscriber::onKernelRequest
	 */
	public function loaded()
	{
		//add_action
	}
}

Last updated