The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
27 views

PHP header() gives headers already sent

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 ...
0
votes
0answers
54 views

Init hook for header send

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 ...
0
votes
2answers
55 views

Basic function call on init failing

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 ...
-1
votes
1answer
26 views

Why do I need to register my custom post type a second time when flushing rewrite rules?

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 ...
0
votes
1answer
61 views

Init hook function to call other hook in function.php

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

Post submit using shortcode and init

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' ); ...
1
vote
1answer
98 views

add_feed and flush_rewrite_rules

There seems to be quite a controversial opinion on the WordPress flush_rewrite_rules() function. According to the Codex, it is highly discouraged to use this function on the init action hook. ...
0
votes
1answer
72 views

Best hook for a function which adds shortcodes to the system?

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 ...
0
votes
0answers
153 views

WP_Redirect on User Region - GeoIP

I have a main homepage for my site and will have several other 'homepages' for different countries in the future. I am trying to redirect the user to the right 'homepage' for their country based on ...
1
vote
1answer
281 views

Form Shortcode not saving data to WP database

I'm developing a plugin that creates a custom table upon plugin activation. The plugin allows users to add a form shortcode to collect data for leads. I've got to the point where either the data ...
1
vote
2answers
490 views

How to setcookie if is_page('page') ? should I use add_action('init') or there is another action?

I want to setcookie if is_page('arabic') or is_page('english') then redirect to home_url() only if the page name/slug arabic or english, I think that init action happen before the code determine the ...
1
vote
1answer
368 views

Problem with is_page & wp_redirect

I use cookies to determine which menu I should use on my website. This is working fine, but I want to force the correct one if someone views the URL directly instead of via the URL with a query string ...
0
votes
0answers
458 views

do_action( 'init' ) in wp-settings.php breaks my website. All plugins and themes disabled

As the title says, do_action( 'init' ) in wp-settings.php breaks my website. All plugins and themes have been disabled. Basically if I comment out line 308 which is simply do_action( 'init' ); then ...
0
votes
0answers
103 views

add_action not working in header?

i need to enable the session variables to my theme , so i have the following code in my theme functions.php function session_manager() { if (!session_id()) { session_start(); // Get ...
0
votes
0answers
259 views

Front end form submission/processing, without using a template file

I'm writing a plugin which has a front end form that is generated by a shortcode. I'm struggling with processing the form submission in any way. Many tutorials describe placing form processing code at ...
1
vote
1answer
112 views

Load ajax if is_home()

I want to show some simple things on homepage with ajax. The problem is I want to load everything when is_home() is true. Php, js, everything. In funtions.php: add_action('init', ...
0
votes
1answer
58 views

How to do a task only once for logged in users

I want to do a task only once after an user has visited my site. I am currently doing like this: function my_task(){ //do my tasks } add_action('init', 'my_task'); I am doing this from a ...
0
votes
2answers
633 views

WordPress Theme activation hook?

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 ...
0
votes
1answer
53 views

Stop WordPress Entirely and Run My Own Code

I have a site that must be deployed in a WP Multisite environment but none of the code in the site uses WordPress at all. How can I intercept WordPress, perhaps at 'init', and tell it to stop doing ...
1
vote
3answers
1k views

Using get_terms for custom taxonomy in functions.php

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 ...
8
votes
2answers
3k views

Use wp init hook to call other hooks?

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 ...
0
votes
1answer
189 views

Developing plugin, where to place action hooks etc?

I am dividing my plugin code into multiple files and functions. When I have a function and straight after it an action hook, or for example add_shortcode, should that line go straight after the ...
4
votes
1answer
319 views

When we register a custom taxonomy or post type, does the WP database modified at all?

When you use the register post type and register taxonomy functions in your functions.php, where do all that setting info get stored in regards to the CT's and CPT's you are registering? I'm talking ...
0
votes
2answers
2k views

IE 9 Clears Form Fields

This is a really strange issue that I cannot seem to solve. I have several forms (login, registration, and other) outputted on a site via short codes. When the forms are submitted, their data is ...
1
vote
2answers
1k views

Change page title from plugin

Is possible to change page title on the fly from plugin? I've try global $post, but seem like plugin runs after. Any Ideas? Edit: Im writting some pages on the fly, based on same page / post, so ...
-1
votes
1answer
80 views

theme or plugin or server is outputting html before the init hook fires, how is it possible to prevent this

I have a plugin that detects the useragent of a request made during the init hook and if it matches my desired value, I set a flag so that my own xml content is sent during the found_posts filter ...
-1
votes
2answers
309 views

Are there any action like 'init_frontend'

I've found init and init_admin. Are there any action that executes just in the frontend? Thanks.
-1
votes
1answer
698 views

plugin: 'init' hook, check if we're not in admin

I've tried this inside of my plugin ('init' hook) but it doesn't work: if(is_front_page() || is_singular() || is_archive()) { ... } How could I check it using init hook? Thanks.
3
votes
1answer
2k views

What is the very earliest action hook you can call?

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 ...
0
votes
1answer
181 views

Preset Widgets ONLY after site is initially created

I want to preset some widgets using functions included in my theme ONLY after a site is initially created (my theme is the default for all new sites in my instance of WordPress). I DO NOT want my ...
3
votes
1answer
3k views

Difference between after_setup_theme and init action hooks?

What is the difference between the after_setup_theme and init action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).
4
votes
3answers
3k views

Which hook should be used to add an action containing a redirect?

I want to build a plugin that grabs certain url params from the query string to build a new query string for the same page. I'm following the excellent the Professional WordPress Plugin Development ...
4
votes
1answer
941 views

when should an action be added to init and when should it be added to wp_head

How do you know when to add your action to init or wp_head. In particular with regards to scripts and styles, but also any other action.
6
votes
5answers
3k views

Marking future dated post as published

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 ...