Home Forums ACF PRO Option pages – possible to limit media library 'to post' (option page)?


Option pages – possible to limit media library 'to post' (option page)?

  • Hey guys,

    I am trying to create two separate option-pages (let’s call them gallery and projects):

    	'page_title' 	=> 'Projects',
    	'menu_title'	=> 'Projects',
    	'menu_slug' 	=> 'projects-input',
    	'post_id'	=> 'projects',
    	'capability'	=> 'edit_posts',
    	'position'      => 41
    	'page_title' 	=> 'Gallery',
    	'menu_title'	=> 'Gallery',
    	'menu_slug' 	=> 'gallery-input',
    	'post_id'	=> 'gallery',
    	'capability'	=> 'edit_posts',
    	'position'      => 42

    Both of these option pages should contain fields with images (gallery has a Gallery, projects have an image). This all works fine. However, I would like to limit the media library choice to “post only”, so the gallery would show only the images uploaded there and projects would only show images uploaded in that option page (of course the image fields/gallery have “Uploaded to post” selected). I naively thought that setting a different post ID may restrict it but it it not so.
    Is this possible at all or do all option pages share the same media library?
    Thanks a lot for any help!

    PS: Please excuse my lack of knowledge, this is the first week I am dealing with WP and php in general. 🙂

  • Hi @poco

    Hmm.. They aren’t really separate pages in the DB but rather just two settings pages for the same kind of input (all fields for options pages end up in wp_options table).

    So we can’t really separate them as they aren’t “different” if you understand what I mean 🙂

    Your only solution would be to instead assign these to two different pages and just use those pages as “settings pages”. Not that pretty but it works 🙂

  • Thanks confirming / setting it clear, Jonathan. I guess I will redesign it a bit then. 🙂

  • No problem!

    Best of luck in your project.

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

The topic ‘Option pages – possible to limit media library 'to post' (option page)?’ is closed to new replies.