Support » Plugin: View Own Posts Media Only » Conflict with Advanced Custom Fields

Viewing 14 replies - 1 through 14 (of 14 total)
  • @josh_fester, ACF is changing a lot of things in version 4, and many regarding media management.
    If you are able, test it out:

    Josh, did you find a solution that is ACF compatible?

    Actually, I just installed this plugin and ACF still works fine at least on custom post types (I don’t have any custom fields set up for standard posts).

    Still not working with ACF, even with ACF 4.0 beta installed.

    For me it works only partially. It works with Administrator users, but my custom roles don’t work. When I disable the plugin, my ACF works normally.

    Custom fields created by ACF are not showing up for me either with this plugin enabled.

    Plugin Author Vladimir Garagulia


    Yes, I should visit this page more often :).
    But I’m wonder, why nobody contact me directly or via
    I just published version 1.1. with similar fix for “Contact Form 7” plugin. I can not release version 1.2 just after 10 minutes after version 1.1. So let’s wait a week for the official update. For that time you may replace this function at includes/class-view-own-media-posts-only.php

    public function query_set_only_author($query) {
    		global $current_user;
    		// do not limit user with Administrator role
    		if ( current_user_can('administrator') ) {
        // do not touch anything for listed custom post types:
        $do_not_touch = array(
           'wpcf7_contact_form', // Contact Form 7 requests
           'acf'  // Advanced Custom Fields
        $post_type = $query->get('post_type');
        if (in_array( $post_type, $do_not_touch )) {
    		$suppressing_filters = $query->get('suppress_filters');	// Filter suppression on?
    		if (!$suppressing_filters && is_admin() && current_user_can('edit_posts') && !current_user_can('edit_others_posts') ) {
    			$query->set('author', $current_user->ID);
    			add_filter('views_edit-post', array(&$this, 'fix_post_counts') );
    			add_filter('views_upload', array(&$this, 'fix_media_counts') );

    and use ACF without problem. Thanks.

    @vladimir Garagulya

    Thank you for this fix code! It works like a charm with Advanced Custom fields. I hope we can see this included on the next patch straight prolly? Was really a life/user navigation saver 🙂


    Plugin Author Vladimir Garagulia


    Thanks, Niko, for your feedback.
    I plan to add the section to the plugin options page, where user could select yourself, what custom post types plugin should ignore.

    Plugin Author Vladimir Garagulia


    Hi Niko,

    Please share the result of testing version 1.2. You need manually turn on exclusion for the ‘acf’ custom post type at plugin Settings page.


    @vladimir Garagulya

    I apologize for not getting back sooner. I had an issue with my WordPress account and did not realize it.

    Version 1.2 resolves this problem. It’s awesome to have the new options! However, I’ve noticed a new issue with ACF. Whenever a field in ACF is a post object, it shows up in the form as a list of every single post. Any thoughts on how to limit this dropdown box to just the posts created by the user? Thanks

    Plugin Author Vladimir Garagulia


    Could you provide more details with screenshots, what dropdown box, on what form, what items do you not wish to see there?

    It turns out it wasn’t an issue with ACF. It was just an issue with my user capabilities. I only want administrators to see other people’s content, and other user groups have customized permissions.

    To solve it I changed line 209 of includes/class-view-own-posts-media-only.php from this:

    if (!$suppressing_filters && is_admin() && current_user_can('edit_posts') && !current_user_can('edit_others_posts'))

    to this:

    if (!$suppressing_filters && is_admin() && !current_user_can('administrator'))

    It would be really sweet to have options asking which user roles we want to see others’ posts 🙂

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Conflict with Advanced Custom Fields’ is closed to new replies.