init's questions - English 1answer

69 init questions.

I wanted to include a PHP file to my plugin. So I added following code to top of my plugin. require_once( plugin_dir_path( __FILE__ ) . 'inc/test-file.php'); But it didn't worked. Then I tried ...

This is my function $enable = false; //if false is provided then the action should run and remove the breadcrumbs if($enable ===false){ add_action( 'init', 'woo_remove_wc_breadcrumbs' ); ...

I have process_ipn method that runs on init action hook. Looks like it is fired after PayPal returns to merchant. Under this method, I could find out the payment status such as completed, pending, ...

Use case: I have a post type that relates to a music show. The 'show time' is grabbed through the post publish date which is set to some time in the future. I've found a function that takes future ...

If there's no child theme available, I use a custom plugin for some minor changes. The following code for hiding update notifications etc. has always worked perfectly. However, if I switch from PHP 7....

I've found init and init_admin. Are there any action that executes just in the frontend? Thanks.

I am trying to redirect the user after form submission using wp_redirect() but it it is not working. I am submitting data using init action hook. here is the code. function ...

We've got a few customizations to the standard WP installation, specifically a custom post type, some custom fields implemented using CMB2, and some hooks to admin menu configuration using the ...

I have a plugin released, and one of my customers was reporting a problem where the plugin was outputting ads in the header area of their website. I have a function defined which contains my ...

I have trouble running jQuery on every save of the custom widget. I have used 'init' hook and tried to enqueue the scripts file, but it runs the code only page refresh not on every time I save the ...

In my plugin, I'm using wp_ajax, This hook does not work when I wrap the init function call with a condition like this : public function __construct(){ if( isset( $_GET["page"] ) && $_GET["...

I have been scratching my head since last few hours. But still not able to find the cause of the issue. I have created a wp_mail() function which is as follows: if( !empty( $_GET['A'] ) && !...

After the solution to this question was to get a function to launch BEFORE the init action is fired by taking the sequence out of its function, it got me thinking, is there any earlier in the WP load ...

I know the many tricks to see if said theme is activated, I have scoured the internet. I am not looking for re-pasting of that code. What I am looking for though is weather or not 3.3-3.5 released a ...

Hello in the "action init" to fairly large function, but I would like to add a filter to modify the vars variables, for example the wordpress post ID. That is to say: add_action( 'init',function(){ ...

I'm hoping someone can point me in the right direction here. I'm using the Wordpress Plugin Boilerplate to develop a custom plugin. On install, the plugin will register a new post type (course), a ...

I have this simple code below: function func1() { echo "this is amazing"; } add_action('reko_hook','func1'); Now, I know that I could use reko_hook(); either inside index.php or page.php where I ...

Is there any way I can get a log of the method calls that are made when do_action( 'init') is fired?

Based on the trick of using set_query_var with get_template_part to easily pass variables from one template file to another (see here: Method 3), I thought I could use the same method for passing ...

UPDATE: I've done some more research on my problem and have narrowed down the problem further. The question below has been very rewritten from the original. I'm trying set up a plugin to redirect ALL ...

Why do I need to use the "init" hook instead of the "admin_init" hook? init:fires after the core of the wordpress is loaded but before headers are sent admin init:before any other hook when the user ...

I just realized that crawlers like google are triggering massive activity from all add_action binded to 'init'. Is this normal behaviour? Is it possible to trigger 'init' only for legit visitors?

My problem is that I can't refresh the page after a form action into a loop. In my case I have a listing post page where I can delete, archive, deliver posts through a modal form, row by row. After ...

I have a multi-author blog, on which there are two schedule cron functions. The first function moves all public posts in the pending status after 365 days: if( ! wp_next_scheduled( '...

I need to create rewrite rules for my plugin. This plugin will be running on a very large WordPress Network (+2000 sites) so performance is important. Most tutorials and the codex recommend to ...

We have this website that the navigation between pages work with ajax. in the blog page we use this great plugin to make the ajax load-more posts. all works great but the problem is that when you ...

I have a method that logs the users login time. public function log_login() { if ( isset($_COOKIE['current_visit']) ) { return; } // Get current user $user = ...

I have a function which checks if $_POST is set (a form which submits to the same page). I need to have it initialized before the page is loaded because the function will do a header redirect if the ...

When WordPress is loading and the theme is parsed, which file is loaded first? Is it one of the template hierarchy members or is it functions.php? Are there exceptions to the load order of files in ...

I`m trying to retrieve the names of taxonomy items and include them into a theme admin panel. function retrieve_my_terms() { global $terms; $terms = get_terms('taxonomy'); foreach ($...

I'm developing a plugin that handles form submissions at several different points. As such, I was relying on being able to use global $post and get_query_var to determine which stage the user is at ...

I did a plugin to create a when the cookie is FALSE. Actually, the was working, but when I was about to create the cookie, it said that my header was already sent. Then, I had the code add_action('...

When I activate my plugin, I need to call an API, to get some items, lets say fruits, flowers and animals. I need to create taxonomy terms out of these items. Then I need to loop over these items and ...

When I install the plugin, I want to create 10 CPTs of a particular type, which I define in the init action hook, and want to assign 10 terms of a custom taxonomy, which too is defined in an init ...

I want to know if it is a good practice according to WordPress theme or plugin development. add_action('init','all_my_hooks'); function all_my_hooks(){ // some initialization stuff here and then ...

I have added custom setting options page under WordPress settings and those are working perfectly. I have tested their values also. But when I am using those values inside function file within ...

I have an interesting issue. I need to launch an action on widgets_init, but ONLY on the WordPress Dashboard. So I can't use dashboard related hooks, because they fire too late; it has to be on ...

My question title might be little confuse. Here is the scenario, For example: I am giving an API service from my wordpress site. Using it others can know few information. Like if they send a User ID ...

Given a custom URL like: http://clientsite.com/tvt?pmc_task=member_check&post_id=1041&user=3851&status=approved I'm trying to catch the URL and add the user_id to a custom post meta ...

I 've just noticed that the init event of a plugin I write myself keeps firing every minute or so if any dashboard's page is loaded in the browser, without interacting with it or even focus on it. Is ...

Im trying to run a $wpdb->insert ONCE on every page load (for testing purposes). The insert will insert a meta field for a post type. I have tried hooking the insert function into "init", add it to ...

I have a plugin that helps me to make lazy loading on posts of a custom post type. The idea is to add an action to the template_redirect/init and get data from the global $wp_query to make jquery ...

I'm building a localized widget and the translation works everywhere but in the language string in the constructor. I have read that the whole plugin initialisation has to be bound to the init ...

class GridModSidebars{ public function init(){ add_action('widgets_init', array($this, 'registerSidebars'),20); } public function registerSidebars(){ $args = array( 'name' =&...

I am working on a checkout proces in Wordpress where if customer clicks on the checkout button he gets redirected to a payment provider. Important to know: I use a session in this proces. I use PHP ...

I am working on a checkout proces where if I submit the checkout I get an error "headers already send" because I use a PHP header() function to send the customer to my payment provider url. My idea ...

I've been banging my head against this for a while. I have this very straight-forward code in my plugin: add_action('init', 'register_shortcodes'); $shortcodeRegistrationRan = False; function ...

If I register my custom post type when the init action fires (which is before plugin activation) why do I need to register my custom post type a second time when flushing rewrite rules (on plugin ...

I am trying to add a function in the init hook that will call another hook like this : add_action( 'init', 'loadAfterUserRegistrationHook' ); function loadAfterUserRegistrationHook(){ ...

I'm trying to find the best way to return errors to a page once a form submitted by using a shortcode. I'm adding a function to init such as - add_action( 'init', 'contact_form_process_post' ); ...

Related tags

Hot questions

Language

Popular Tags