Losing selection when editing
-
Is it possible to retain the link when editing the selection?
-
Could you please be more specific as to what you are trying to do and what is happening?
Thank you.
Ah, it actually works fine in a custom post. But in an ACF widget, it doesn’t:
What version of ACF Link and WP are you using? I cannot reproduce this. It could be another plugin interfering?
The latest versions of both. I’ve disabled all plugins except ACF ones, but it still happened. Is this related to trying to use this field in an ACF Widget?
Very weird. But no it should work no matter where you include it. What browser are you using? Are there any JavaScript errors if you open the browser console?
ReferenceError: assignment to undeclared variable $selector
http://localhost/AIDSLifeCycle/StagingSite/deploy/web/wp/wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-input.min.js?ver=5.3.8.1
Line 1ReferenceError: reference to undefined property a[b]
http://localhost/AIDSLifeCycle/StagingSite/deploy/web/wp/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,jquery-ui-resizable&ver=4.5.2
Line 4This is still a problem http://quick.as/yaxi8n14
Can you two please let me know exactly what versions you are using of each of the following:
WP version
ACF PRO version
ACF Link versionAs well as your exact browser and version.
I cannot reproduce with the following:
WP 4.5.3 (alpha)
ACF PRO 5.3.8.1
ACF Link 1.1.2
Firefox 45.0.1 and Chrome 52.0.2743.10 devThank you.
WP: 4.5.2
ACF Pro: 5.3.8.1
ACF Link: 1.1.2
Firefox: 47.0b9
Chrome: version 50.0.2661.102 mThank you. I’ve realized that my plugin was not correctly detecting if the link dialog scripts had already been loaded or not and was then loading them twice if there was already an editor on the page.
Please install this patched version and let me know if it fixes the issue. If all is good then I can release a new version right away.
It appears to be working. Though now I’m noticing that “open in the same window” is adding target=”0″, which is targeting a new tab.
Where is it adding target=”0″? The field is saved in the database as either a “0” (same window/tab) or “1” (new window/tab), and it is the developers responsibility to use that how they see fit. For example:
<?php $link = get_field('link'); $target = $link['target'] ? ' target="_blank"' : ''; $a = sprintf('<a href="%s"%s>Link</a>', $link['url'], $target);Ah! That solves it. Thanks.
ww.wp.xz.cn double posted.
Great. You could always add a filter to format the target how you like. Example:
add_filter('acf/format_value/type=link', function ($value, $post_id, $field) { $value['target'] = $value['target'] ? '_blank' : '_self'; return $value; }, 10, 3); $link = get_field('link'); printf('<a href="%s" target="%s">%s</a>', $link['url'], $link['target'], $link['title']);I’ve released a new version (1.1.3) with the previous fixes for the edit functionality.
Thank you for your help and patience.
The topic ‘Losing selection when editing’ is closed to new replies.