0

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';
}
8
  • 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
    Commented May 22, 2013 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
    Commented May 22, 2013 at 16:53
  • i have updated my question Commented May 22, 2013 at 16:54
  • same question/answer
    – Milo
    Commented May 22, 2013 at 17:07
  • @Milo I tried that nothing happened Commented May 22, 2013 at 17:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.