Tag Info

Hot answers tagged

2

Plugins load before themes. The earliest hooks available to plugins is plugins_loaded (or muplugins_loaded for mu-plugins), while themes run on after_setup_theme and later hooks. So you better just load the file [that contains the class] on a specific hook in your plugin. It probably is best to load it on a lower priority than the default 10. Below I use 5 ...


2

WordPress has finally documented all its hooks. :D You can browse and search there.


2

For that I would suggest to use 'init' hook. According to codex This runs after WordPress has finished loading but before any headers are sent For more details visit codex explantion and examples for this hook; Codex link. You can find answer to similar question over here; How to set custom cookies before output


2

There is nothing technically wrong with that, but backslashes are hard to type on some keyboard layouts. On a German keyboard for example, you have to hit the right AltGr key plus \ at the same time. This is not easy to type (and one of the reasons why I use an English keyboard). Use dots, colons or underscores to namespace your hooks. They are not bound ...


2

I was able to resolve both defaulting to the Visual editor and hiding the tabs with the following code. Dumped the following in plugin file: add_filter( 'wp_default_editor', array($this, 'default_editor') ); Hide the tabs with this javascript: $('.wp-editor-tabs').remove(); Or hide it with CSS: .wp-editor-tabs{display:none;}


1

Here are two untested ideas: Idea #1: If you want to hook before an instance of the Plugin_Upgrader class is created with: $upgrader = new Plugin_Upgrader( ... ) where the upgrades are activated with: $upgrader->upgrade($plugin); // for a single plugin upgrade $upgrader->bulk_upgrade( $plugins ); // for bulk plugins upgrades then you ...


1

When it comes to the oop way of doing things you need more than just the class, you also need to instantiate it as an object at some point if you want the action to fire. class myClass{ function __construct(){ add_action( 'init', array( $this, 'someFun' ) ); } function someFun(){ include( 'my-script.php' ); } } ...


1

If you need to change the template used, you can use the template_include filter (change "itermediate-template.php" and "page.php" with correct file names of your template files): add_filter( 'template_include', 'cyb_exclude_template_for_editors', 99 ); function cyb_exclude_template_for_editors( $template ) { $user = wp_get_current_user(); if( ...


1

The hooks are fine for change the login style. I think is better idea to identifier, why is the load so much slow. I have a lot of change for different installs and no problems with this hooks. But I see also often a lot of loads of unused source. I change the login style with this class: ...



Only top voted, non community-wiki answers of a minimum length are eligible