Home Forums ACF PRO Removing a page added with acf_add_options_page


Removing a page added with acf_add_options_page

  • Hi there,

    Can someone please tell me how to remove this page that was added with acf_add_options_page?

    I’m working on a site where a page was added with acf_add_options_page and I’m trying to remove it. I removed the acf_add_options_page code but the menu item still shows up and the page still works fine.

    I can use remove_menu_page but that only removes the menu item, the page can still be visited.

    Is there not something like acf_remove_options_page?

    Why can I find no record of the page in the database? How is this even possible?


  • The only way to add an options page is to use the function acf_add_options_page or acf_add_options_sub_page. Search your theme and plugins for these functions.

    Options pages and admin pages are not things that get stored in the database. They are like post types and taxonomies, until you actually add a post or term that uses them they are code only.

  • Thank you for your response!

    So what if a post or term that uses them was added and then the menu was removed?

    It was an ACF option page, which basically seemed like a post to me which I could assign custom fields to so if custom fields were added to it and then removed and then the menu was removed in the code would the menu item then stay?

    I will also check to see about a cache or some rogue file on the server or something.

  • If you remove the code that registers a post type or a taxonomy you loose the ability to edit them in the back end, the menus are removed and if you try to access those pages edit pages you’ll get a 404. With a taxonomy you will also loose the ability to display them on the front end. Not exactly sure if you can show the post, that might depend on the rewrite rules, but I’ve never tried. If I’m going to remove a post type I generally make sure I delete all the posts first so they’re not hanging about the database.

    With an options page, if you remove the code that registers the options page you will loose the ability to edit the options and the link will be removed from the menu and you will get a 404 if you try to access that page. but the values will still exist in the database and ACF will still be able to get them and display them. You could also use `get_options(‘options_’.$field_name’);

    If you are still seeing an options page then there is code somewhere that is creating that options page.

  • Thank you for your great answers! They helped me a lot!

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

The topic ‘Removing a page added with acf_add_options_page’ is closed to new replies.