Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created November 15, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/fbdf624084c08b4df5d51a7aa0c3c59e to your computer and use it in GitHub Desktop.
Save tripflex/fbdf624084c08b4df5d51a7aa0c3c59e to your computer and use it in GitHub Desktop.
Add attributes to text field template input when using WP Job Manager Field Editor
<?php
add_filter( 'field_editor_text_field_attributes', 'smyles_add_text_field_attr', 10, 4 );
function smyles_add_text_field_attr( $attr, $key, $field, $value ){
if( $key === 'some_meta_key' ){
// Add readonly attribute (replacing any others added through this filter)
$attr = 'readonly="readonly"';
}
return $attr;
}
@tripflex
Copy link
Author

If using WP Job Manager Field Editor 1.8.5 OR OLDER you need to update the template file here:
https://gist.github.com/tripflex/063f4e7463a0d270a1f717fd4939531d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment