Title: Relation field problem
Last modified: December 13, 2024

---

# Relation field problem

 *  Resolved [hasanfachrul](https://wordpress.org/support/users/hasanfachrul/)
 * (@hasanfachrul)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/relation-field-problem-2/)
 * how can I use pods block item list to list all the custom post type where custom
   fields is current user?
 * I have certificate custom post type, and want to list all the certificates based
   on the current user id

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/relation-field-problem-2/#post-18196109)
 * First, enable Dynamic Features in Pods Admin > Settings > Security section so
   that the block `WHERE` field displays.
 * Option 1:
    1. Use magic tags by adding `define( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS', true);`
       to wp-config.php
    2. Use `{@user.ID} IN( custom_field_name.ID )` for the WHERE query, meaning the
       current user ID is found in a field named `custom_field_name` on the queried
       pod, which would be a relationship field connected to users.
 * Option 2:
 * If channging wp-config.php is challenging or the magic tag `{@user.ID}` does 
   not work as expected, add this PHP code snippet with a plugin like Code Snippets:
 *     ```wp-block-code
       add_filter(	'pods_pods_find',	function( $params ) {		$params = (array) $params;		if ( array_key_exists( 'where', $params ) ) {			$params['where'] = str_replace(				'CURRENTUSERID',				get_current_user_id(),				(string) $params['where']			);		}		return (object) $params;	});
       ```
   
 * Then use `CURRENTUSERID IN( custom_field_name.ID )` as the WHERE query, with 
   the same `custom_field_name.ID` assumption as above.
 *  Thread Starter [hasanfachrul](https://wordpress.org/support/users/hasanfachrul/)
 * (@hasanfachrul)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/relation-field-problem-2/#post-18196114)
 * I see, it still doesn’t work. I have a custom field called achiever (it’s a relation
   field to user) but the magic tags for achiever doesn’t show up on pod templates.
   is it the problem?
 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/relation-field-problem-2/#post-18345348)
 * Apologies for the delayed follow-up.
 * If `{@achiever}` and `[each achiever]{@user_login}[/each]` don’t display anything
   in the templates, make sure the Pod Block or shortcode is querying the post type`
   certificate`
 * The code provided previously was for modifying the `WHERE` field on the Block,
   which displays if SQL is enabled in `Pods Admin > Settings`
 * If it’s still challenging, please open a new ticket with more details about the
   setup or join the support chat on Slack using the link at [support.pods.io](https://support.pods.io)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Relation field problem’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [pdclark](https://wordpress.org/support/users/pdclark/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/relation-field-problem-2/#post-18345348)
 * Status: resolved