Home › Forums › General Issues › acf/format_value for specific field
Is there a way to apply the acf/format_value filter to a specific field (not a specific type) only.
I tried:
function my_acf_format_value( $value, $post_id, $field ) {
if ($field == 'my_field_key') {
// return
return $value.' - test';
}
else {
return $value;
}
}
add_filter('acf/format_value', 'my_acf_format_value', 10, 3);
But didn’t work.
hi ben,
I’m trying to add text before a user-filled field. For example: Add TEL: Before a phone number entered by the user, how do I do this? Similar to what you did?
AM ISRAEL CHAI!
They didn’t let me post a comment in Hebrew;)
Because I’m a noob…
I saw it here on the forum
$phone = get_field('phone-number');
<a href="tel:<?php echo $phone; ?>"><?php echo $phone; ?></a>
But I have no idea where to put it ..
What i mean is using the simple “prefix” option in the field options, without using code at all.
What are you trying to do?
I have hundreds of posts with this phone number, it’s a user-editable business card and I don’t want him to be able to delete the TEL:
Does he have access to the ACF Admin? (and if he does, can’t you just block it? Very good plugin here btw)
the user has access only to the front and ..
And I do want him to have the access to edit his phone number – the process of creating a business card – is also almost completely automatic
Today, at the time of the card creation, a line of telephone already have the TEL: but it is erasable – and ugly
So ill ask again π
Why donβt use the prefix option?
It will apply to every phone out there and he won’t be bale to change it.
I probably don’t know how to do it .. I understand it’s a simple thing, but how to do it?
If it’s too much already, I’ll try to dig some more online π
I tried, the problem is:
I associate the value entered with a dynamic field in elementor.
The dynamic field is a URL field
The output I get is this site.com/0501234567 which is not good for me – so looking for more options .. π
tel:0501234567
and few more – i just need to figure out the first and that’s it π
I can try to help, but i need some details about how you setup everything, you write very short and vaguely…
First of all thank you!
I prefer to speak in our native language, how can we communicate except here? Facebook? whatsapp? Mile?
tizckeh le mitzvot!
Can’t see …
here Try this
https://www.screencast.com/t/IiyY5eTvkd π
The topic ‘acf/format_value for specific field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.