Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Dirk

Adding dropdown for user custom fields

I found this post https://www.admincolumns.com/documentation/filter-reference/acp-editing-view_settings/ and modified the code for my field, but its not working and I’m not really sure how it’s supposed to work.

Is it supposed to create a custom input type for inline editing or does it just change the functionality of the inline editor for text and text area input types?
Will this sample work for all metadata types, i.e. post, user, etc.?

4 years, 6 months ago
Stefan van den Dungen Gronovius
Developer

Hi Dirk,

This specific hook, allows you to change the default behavior of the Inline and Bulk Editing feature for specific columns. For example if you have defined a custom field in your code that is somehow populated in the backend with a custom drop-down box, you could add this drop-down editing feature to the column as well.

If you look at the example on the documentation page, you see that we do two checks:
1) Column type -> in this case the Custom Field column.
2) Meta key -> this is a specific property for the Custom Field column that contains the set meta key from the settings.

Once you have checked your specific column, you can alter the editing behavior for that specific column. If you have not conditionals at all, you change the behavior for all columns, something you probably not want :)

The example is not written specifically for a list screen type and will work for all custom field columns that are set to work on the meta_key ‘my_fruit_custom_field’. You’ll have to change the key of course to the key you want to change.

4 years, 6 months ago
Dirk

I have a plugin that creates the backend dropdown. I think you are saying that the meta key here is not the meta key for the custom field. How would I determine the correct meta key property?

4 years, 6 months ago
Stefan van den Dungen Gronovius
Developer

No the meta key in the conditional is the meta key for the custom field.
Maybe you can contact me on the chat on our website so I can help you out?

4 years, 6 months ago

You must be logged in to reply to this topic.