Customizing Access Rights in Pods with Constants/Hooks

How to customize Pods Access Rights through code

There are a number of constants and hooks that you can use to customize the Access Rights in Pods.

For constants, you can edit your wp-config.php file to add them. For hooks, you’ll want to know how hooks work in WordPress and place them into your own plugin file or use a plugin like Code Snippets to place your customizations.

These customizations are available for Pods 3.1+ and the corresponding hotfix releases 2.7.31.1, 2.8.12.1, 2.9.19.1, and 3.0.10.1.

Enable all dynamic features

define( 'PODS_DYNAMIC_FEATURES_ALLOW', true );

Disable all dynamic features

Please note that disabling through this constant will override whatever setting you set on your pod itself.

define( 'PODS_DYNAMIC_FEATURES_ALLOW', false );

Specify certain dynamic features to enable

Options: display, form, view

You can provide a comma-separated list of dynamic features to enable.

define( 'PODS_DYNAMIC_FEATURES_ENABLED', 'display,form' );

You can also provide an array of dynamic features to enable.

define( 'PODS_DYNAMIC_FEATURES_ENABLED', [ 'display', 'form' ] );

Restrict all dynamic features (for all Pods)

define( 'PODS_DYNAMIC_FEATURES_RESTRICT', true );

Unrestrict all dynamic features (for all Pods)

Please note that disabling through this constant will override whatever setting you set on your pod itself.

define( 'PODS_DYNAMIC_FEATURES_RESTRICT', false );

Restrict specific dynamic features (for all Pods)

Options: display, form

You can provide a comma-separated list of dynamic features to restrict.

define( 'PODS_DYNAMIC_FEATURES_RESTRICTED', 'form' );

You can also provide an array of dynamic features to restrict.

define( 'PODS_DYNAMIC_FEATURES_RESTRICTED', [ 'form' ] );

Restrict specific form features (for all Pods)

Options: add, edit

You can provide a comma-separated list of form features to restrict.

define( 'PODS_DYNAMIC_FEATURES_RESTRICTED', 'edit' );

You can also provide an array of form features to restrict.

define( 'PODS_DYNAMIC_FEATURES_RESTRICTED', [ 'edit' ] );

Disable all access-related restricted messages and admin notices

define( 'PODS_ACCESS_HIDE_NOTICES', true );

Customize which properties should be bleeped

You can customize the list of properties to be “bleeped” from being displayed.

add_filter( 'pods_access_bleep_properties', static function( $additional_bleep_properties ) {
	$additional_bleep_properties[] = 'user_login';

	return $additional_bleep_properties;
} );

Disable output sanitizing on fields that take HTML

Most fields go through a special check to see if they allow HTML and which HTML tags they allow. If you are allowing script tags or other special HTML that would normally not be allowed within post content itself, those will get sanitized as a result.

You can customize this with a hook that targets a specific field like:

add_filter( 'pods_field_maybe_sanitize_output', static function( $should_sanitize, $value, $options ) {
	// Only allow unsanitized output for a specific field.
	if ( 'my_field_name' === pods_v( 'name', $options ) ) {
		return false;
	}

	return $should_sanitize;
}, 10, 3 );

You can also disable output sanitization altogether but please be aware that this should only be done on sites that you have trusted users for and where content is not coming from other third party sources or form submissions.

add_filter( 'pods_field_maybe_sanitize_output', '__return_false' );

Other Helpful Documentation on Access Rights in Pods

Access Rights in WordPress core

An overview of how WordPress handles access rights

Access Rights Settings in Pods

The Global and Per-Pod settings available to customize your Access Rights