wp_redirect() – headers already sent

Found the answer (via) Instead of using the function I added an action to “wp_loaded”, that makes sure that it gets loaded before any headers are sended. <?php add_action (‘wp_loaded’, ‘my_custom_redirect’); function my_custom_redirect() { if ( isset( $_POST[‘subscribe’] ) ) { $redirect=”http://example.com/redirect-example-url.html”; wp_redirect($redirect); exit; } } ?>

Why is there a link tag with rel “profile” pointing to gmpg.org?

This profile enables your site to use the FOAF semantic insertions for richer metadata on your site. FOAF goes for Friend Of A Friend and aims to interconnect in “knowledge nodes” all the personal interconnections. Despite it started as a Person to Person oriented RDF vocabulary, it went beyond and included some different larger entities … Read more

WordPress Plugin Development – Headers Already Sent Message

My guess is you get a PHP error, which generates output before the headers are sent. If you have E_NOTICE enabled, calling $_POST[‘foo’] may generate a “Notice: undefined variable” error if that variable is not set. Best practice: never assume anything about GET, POST, COOKIE and REQUEST variables. Always check first using isset() or empty(). … Read more

How to add code to Header.php in a child theme?

I would hook into the wp_head action. I would place this in a plugin so as to abstract it from your presentation layer. This allows for scalability and changing of themes. This also prevents any analytics collateral damage if a step is missed in migration from one theme to the next. add_action(‘wp_head’, ‘wpse_43672_wp_head’); function wpse_43672_wp_head(){ … Read more

Why won’t wp_mail() let me set the From: header when plain old PHP mail() will?

Hi @helenyhou: You can set the header, just not with a parameter. WordPress uses “hooks” and the hooks you need are ‘wp_mail_from’ and ‘wp_mail_from_name’ hooks. Here are the hooks you might add to your theme’s functions.php file to modify the “From:” header when using wp_mail() to the email address Helen Hou-Sandi <[email protected]>: add_filter(‘wp_mail_from’,’yoursite_wp_mail_from’); function yoursite_wp_mail_from($content_type) … Read more