Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to wordpress plugin development. I have created a list page and an add item page. When I add successfully, I want to redirect and it is giving me this error.

enter image description here

Notice the error is on pluggable.php on line 876

I have checked many sources but unable to find the solution so far

  1. I have used wp_redirect('admin.php?page=ccURLList'); exit; it gives the attached error
  2. I have used no-header in the query string of form submission, it does work but in case of any error I wanted to show the page again and that page is without any sidebar or wp stuff
  3. When i move the wp_redirect to my main file clickCounter.php it says function is unknown

If any of you can resolve this issue, it will be highly appreciated.

EDIT

clickCounter.php is my main file. It creates menus etc.

I have a list page which is working.

I have an add page. I have put the wp_redirect on the very first lines after

<?php
// ccURLAdd.php my add page
if (!defined('ABSPATH'))
    die('You are not allowed to call this page directly.');

add_action( 'init', 'CCaddNewLink' );
function CCaddNewLink(){
    wp_redirect(home_url());
    exit;
}
//wp_redirect('admin.php?page=click-counter');
exit;

Below is my main file

<?php
// clickCounter.php my main page.
/* some plugin info */
add_action('admin_menu', 'ccAdminMenu');
function ccAdminMenu()
{
    add_menu_page("Click Counter", "Click Counter", 8, 'click-counter', "ccAdminMenuListUrls", CC_HTML_WEB . "/images/icon.png");
    add_submenu_page('click-counter', 'Add New Link', 'Add Link', 8, 'click-counter-url-new', 'ccAdminAddUrl');

}
function ccAdminAddUrl()
{
    include 'ccURLAdd.php';
}
share|improve this question
    
where do you call wp_redirect? this is not unique to WordPress, you can't send a redirect header after content has already been sent to the browser. –  Milo May 22 '13 at 16:50
    
You are trying to redirect after content has been sent to the browser. This can be intentional content or unintentional, such as echoed Notices. You will need to post your code. –  s_ha_dum May 22 '13 at 16:53
    
i have updated my question –  Aamir Mahmood May 22 '13 at 16:54
    
same question/answer –  Milo May 22 '13 at 17:07
    
@Milo I tried that nothing happened –  Aamir Mahmood May 22 '13 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.