Home Forums Add-ons Options Page Use a options page field as post type menu_title


Use a options page field as post type menu_title

  • I’m trying to use some custom fields from the options page to set up the post type labels. so in my post type plugin it looks like that:

    function custom_post_type_pros() {
        $name_male = get_field('pros_single_name_male', 'option');
        $name_males = get_field('pros_single_name_males', 'option');
        $labels = array(
            'name'                => $name_males,
            'singular_name'       => $name_male,
            'menu_name'           => $name_males,

    It actually worked. i entered some names in the options page and it did used them for the post type labels.

    The problem is: After trying to change those options again it doesn’t change the post type labels again. it sticks with the first option i entered.

    What i have tried:

    So i thought maybe i need to make sure the post type plugin loads only after the options page, but i tried puting the code i metioned above in the head of my post type plugin instead of the functions.php, but it didn’t work.

    Also tried turning the post type plugin off and on and it still uses that old option labels.

    Also tried changing the labels to static ones and the to those variables again. still the same old option is showing as the label. just don’t know where does it come from…

    I need some way to make those labels refresh and get the new names from the options page. every time the plugin loads or something…

    Any suggestions?


  • the first thing that comes to mind is that you have some kind of cache in place that is preventing the new values from being used.

  • Great idea, but wouldn’t my reseting tryings should have solved that if this is the case?

    btw – did try to reset the cache with some chrome plugin.

  • Any other ideas? or any ideas how to check the cache idea other then reseting the browser cache?

  • What I meant by cache is some type of WP cache. Are you running some type of caching plugin? Like WP Super Cache or something similar.

  • Oh, no i don’t use any caching plugin, should i?

    I tried adding “define(‘DISABLE_CACHE’, true);” to wp-config.php but it doesn’t change anything.

  • If you don’t have a caching plugin installed and there is not other form of server side caching then there isn’t any reason that I can see for the values not updating on the front end when you save changes to the options page.

    The best thing you can do is to deactivate all of the other plugins on the site and switch to one of the default WP themes and see if you can figure out where the incompatibility might be.

  • Tried to deactivate and activate my two plugins (only acf and the post type plugin) and tried switching to Twenty Fifteen. nothing is changed..

  • Sorry I didn’t reply sooner, you should probably put in a support ticket since there isn’t any reason I can see for you to be having this issue.

  • Well, that’s odd the way the forum is adding lings now

    try clicking on this link

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Use a options page field as post type menu_title’ is closed to new replies.