Thanks to this feature I don’t need to prefix custom fields names with a unique prefix, in order to avoid conflicts. I can simply register multiple options pages with a different post_id parameter.
Then I’m able to get custom fields like this:
Direct answer to your question:
Fields are saved in the wp_options table, but their names are prefixed with a value of the post_id attribute. So if the field name is field_name and the options page post_id attribute value is custom-id-as-a-string then the database entry is custom-id-as-a-string_field_name.
I think it should be clearly explained in the documentation. It is said in the documentation that the post_id could be an integer or a string, but it doesn’t explain that it can be any string. Users might think that the string should be a post slug or something… This is exactly what I thought before i started to play with custom strings.
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘Explain how acf_add_options_page() post_id works’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users