Skip to main content
1 of 2
frosty
  • 197
  • 1
  • 6

how to use wp_redirect inside a function

I have the following action and function. Ultimately i'm trying to get access to value $processArtwork in my template. One option is pass the value via the querystring. However the following results in

"Warning: Cannot modify header information - headers already sent by"

add_action('init', 'process_artwork');

function process_artwork(){
    if(isset($_GET['ss-process'])) {

                $newUrl = "/process-artwork/?processedArtwork=56";
                
                wp_redirect( $newURL ); 
                exit;
    }
}
frosty
  • 197
  • 1
  • 6