Support

Account

Home Forums Backend Issues (wp-admin) Workaround for “translation” bug in post_object field

Unread

Workaround for “translation” bug in post_object field

  • By using the post_object field you will get the post status in core code -> This results in:

    Post title (draft) as choice in field selection.

    I want to get this as:

    Post title (Draft) and with translation.

    Here is the JS code snippet:

    acf.addFilter('select2_ajax_results', function( json, params, instance ) {
        if(instance.data.field.data.key === 'field_dpf_exhibition_zone') {
            var dpf_options = json.results;
            $(dpf_options).each(function() {
                var test = this.text.search('draft');
                if( test !== -1) {
                    this.text = this.text.replace('draft', acf.__('draft'));
                    this.disabled = true;
                }
            });
        }
        return json;
    });

    Now it works perfectly.

    PS Perhaps the ACF team would test this and mark as bug fur further usage.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.