• Resolved ericr23

    (@ericr23)


    A page using wp_terms_checklist() was working fine earlier today, and then I went back to it and all the checkboxes are disabled.

    What happened? How do I fix it?

    Sample code for the page is:

    $clist = wp_terms_checklist(0,array('descendants_and_self'=>5,'echo'=>0));
    echo str_replace('post_category[]" id="in-category-', '', $clist);

    I tried it with just wp_terms_checklist(0,array(‘descendants_and_self’=>5)); and got the same result:
    <li id='category-218'><label class="selectit"><input value="218" type="checkbox" name="post_category[]" id="in-category-218" disabled='disabled' /> Egypt</label></li>

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ericr23

    (@ericr23)

    Now it’s working again!

    I didn’t change anything on the page before or since.

    Thread Starter ericr23

    (@ericr23)

    But not on my iPad. Back at my desktop, still fine.

    Over to Opera, disabled, too. So, although I had thought I had tested this before, since neither of those other browsers were logged in to WordPress, I logged out of WP and yep, the checklists are disabled.

    Log back in, they are able again.

    So it would seem that wp_terms_checklist(), being an administrative function, is throwing up a security protection when used on a regular page by a nonadministrator. How can I overcome that (through functions.php in the theme, possibly, if not code on the page)?

    Thread Starter ericr23

    (@ericr23)

    I had first tried simply deleting disabled=’disabled’ from the output, but that didn’t work, nor did deleting disabled=”disabled”. But today I tried again, deleting both:

    <?php $clist = wp_terms_checklist(0,array('descendants_and_self'=>5,'echo'=>0)); //Africa
    $clist = str_replace('post_category[]" id="in-category-', '', $clist);
    $clist = str_replace("disabled='disabled'", '', $clist);
    echo str_replace('disabled="disabled"', '', $clist); ?>

    That works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_terms_checklist() outputting input … disabled’ is closed to new replies.