Wordpress Bundle
  • What is Wordpress Bundle?
  • Getting started
    • Installation
    • Wordpress
    • Router
    • Cron job
    • Templates
  • Reference
    • Argument resolver
    • Controller
      • AdminAction
      • BlogController
      • FrontAction
      • WordpressAction
    • Entity
      • Block
      • Blog
      • Comment
      • File
      • Image
      • Menu
      • MenuItem
      • Post
      • Term
      • User
    • Repository
      • CommentRepository
      • PostRepository
      • TermRepository
      • UserRepository
    • Service
      • PaginationService
      • BreacrumbService
  • Guides
    • Server requirements
    • Install plugins
    • Use Multisite
    • Gutenberg
    • WP Steroids plugin
      • Image options
      • Maintenance
      • Admin pages removal
      • WYSIWYG Editor
      • Feature Support
      • Multi-site configuration
      • Constants definition
      • ACF configuration
      • Menu
      • Custom Post type
      • Advanced permalink settings
      • Custom Taxonomy
      • Templates
      • Page states
      • External table viewer
      • Roles
      • Optimisations
      • Security
      • Search
    • Twig Cookbook
    • Inject variables in all templates
    • Internationalization
    • Extending Wordpress Bundle
    • Error pages
    • Site health
  • Integrations
    • Advanced Custom Fields
      • Install ACF PRO
  • Extras
    • Migrating from 1.x to 2.0
    • Roadmap
    • Changelog
    • Alternatives
Powered by GitBook
On this page

Was this helpful?

  1. Reference
  2. Controller

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
	}
}
PreviousBlogControllerNextWordpressAction

Last updated 1 year ago

Was this helpful?