I created a Relationship Custom Field in Advanced Custom Fields, where the users can see and select a post from another custom post type (for eg. products) The problem is that I have a thousands of posts and for the users is a bad experience to search in a dozens of items until find their posts.
Is there any solution that users should be able to see only the items created by them?
Mention that I already put the following code in my function.php but not working for this custom field:
`function mypo_parse_query_useronly( $wp_query ) { if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) { if ( !current_user_can( 'update_core' ) ) { global $current_user; $wp_query->set( 'author', $current_user->id ); } } }
add_filter('parse_query', 'mypo_parse_query_useronly' );`
Any help will be appreciated!
Many, many thanks in advance!
Regards, Burebista
Aucun commentaire:
Enregistrer un commentaire