Modifying a key froam foreach on template.php (1 post)

  1. Daniel Lemes
    Posted 3 years ago #

    Hi, sorry if it's on wrong place, hope not.

    I'm struggling to get this: in a multi-author blog, some of them (those with no admin privileges) shouldn't see some custom fields options. To do this, i didn't found a plugin or any other way except modify the archive wp-admin/includes/template.php.

    This place...

    foreach ( $keys as $key ) {
    echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";

    ...is where i believe i could get what i need, but how to modify (remove) one or more of the keys, keeping others and generating the select with them? Something like this:

    foreach ( $keys as $key ) {
    /* here, get the keys, and if one or more of them are "views" or "seo", remove then, and keep going */
    echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";

    I've tried with "if" statements, but didn't get to the point. Any idea? Thanks in advance for any help.

Topic Closed

This topic has been closed to new replies.

About this Topic