You need to ‘hook’ your function to a valid hook. Your add_action
call is not doing anything, because it is not a proper call to a hook.. See the docs https://developer.wordpress.org/reference/functions/add_action/ for add_action
.
Your function is the second parameter of the add_action
hook. The first parameter is ‘where’ to hook into WordPress. If you want to modify the post content, then hook into the_content
(see https://developer.wordpress.org/reference/hooks/the_content/ ).
But, then you need to parse the_content
to find a number to format. The the_content
hook works on the entire post (or page) content, so your function won’t work.
So, not sure that you can do what you want. But if you are going to use hooks, then you need to learn how they work. The above links are a starting point.
Related Posts:
- Filtering multiple custom fields with WP REST API 2
- Front end form to create a custom post with preview
- Generate a excerpt from an ACF-wysiwyg-field
- Pods cms and “advanced custom fields” plugin
- Adding a body class with ACF
- Order and group posts by acf by month and year
- Vimeo thumbnails [closed]
- pre_get_posts filter using numeric meta_query comparison (from dates)
- ACF + contact form 7
- Is there a way to export Advanced Custom Fields data?
- WordPress Gutenberg, update post content programmatically
- Replace post’s “the_content” with ACF value
- PHP echo stripping formatting in Advanced Custom Fields [closed]
- How to upload multiple images on frontend to ACF gallery using update_field
- Add user custom fields and make editable on frontend
- How I can check if get_theme_mod is in header or a template part
- Using pre_get_posts for meta value of LIKE comparison on ACF repeater sub field
- Advanced custom fields: Customise date picker’s start date (need to choose year 1500 onwards) [closed]
- Display post in order of ACF checkbox?
- ACF: replace comma with another sign [closed]
- ACF custom block get_field() shows null on front-end? [closed]
- How to display genre of music content from one page to another page in wordpress
- ACF Update_field() update the field but changes are not seen in backend or rest api
- How to decrease the number of queries with get_posts and ACF?
- How to make Advanced Forms (and/or ACF) encode input value?
- ACF (Advanced Custom Fields) not updating post or postmeta values
- ACF Wysiwyg Editor Image srcset for responsive images [closed]
- ACF Multiple Checboxes Output
- Filter posts by advanced custom field
- User meta not saving properly
- Filtering from advance custom field data
- Insert Content into Script with Advanced Custom Fields
- Is there a better way of retrieving the name of an acf pagelink type from current post?
- Seemingly Simple Conditional Won’t Work?
- Prepared statements used incorrectly in ACF?
- Hide ACF from source code until a “show” button is clicked
- Pull info from Soundcloud embed into a custom field?
- How to disable field on Advanced Custom Fields? [closed]
- ACF: Querying relationship fields with Author
- Outputing Post Object title as a div class with ACF
- Function wp_enqueue_style was called incorrectly
- Can you make a custom gutenberg block that allows the gutenberg editor within it?
- ACF Clone Field – Set Default Value
- ACF save json to custom directory not working, default acf-json used instead
- ACF Maps admin error: “For development purposes only” even after supplying api key
- Do comparision after updates hooks of acf-fields?
- How do you display a custom field on a new page? [closed]
- Hash password field to database, unhash in admin?
- ACF google map not working [closed]
- Help using acf/save_post hook to connect to Untappd API and update_field [closed]
- Get ACF fields in relationships of returned post
- Random images with no duplicates (ACF Gallery) [closed]
- Pulling in content from another page [closed]
- Advanced Custom Fields – Check multiple Empty Fields [closed]
- ACF: If field contain a specific value, update value in another field
- How to only show ACF field if another block is being used?
- ACF Select Field can’t return Array
- Equation input with preview in classic editor
- Can’t get the frontend cache to be deleted manually
- How to do a WP_Query when a post has a relationship to anoter post via an ACF Post Object field, where the related post is in a certain category?
- Custom ACF block only outputs commented JSON to the DOM
- WP get_posts meta_query using ACF repeater field
- get_posts filter meta_query using ACF Checkbox
- Fancybox3 ACF repeater. URL strip out from the caption field
- Is it okay to use an ACF field to store a password for a protected area of a page?
- ACF Map with custom styles field
- Front End User Registration – How to Save ACF Values?
- Advanced Custom Fields | Help me link to a variable
- ACF Flexible Content with Bootstrap Carousel Repeater
- Which is faster: Loading images from the repo, or loading them using ACF Image Content via Media Library
- help with really simple csv importer
- WordPress API response filter by ACF value
- ACF Pro Date Picker not coming through on Loop
- advanced custom fields if field has value show main div [closed]
- wp_split_shared_term_batch messing up upgraded ACF 5 data
- How to display dropdown filters for posts
- Creating a page from acf fields
- Populate ACF repeater with current structure of pages
- Use an image’s url as argument in update_field function
- Add a mailto button next to custom field download link
- Update the value of every page’s content editor with the value of an Advanced Custom Field on that page
- display content in ascending order
- Add routes between multiple ACF google maps markers [closed]
- Array sorting by custom field date
- Hebrew WP 3.5: plugin activated, does not appear in sidebar [duplicate]
- How to share specific data contained in repeated fields across multiple pages
- Conditional Custom field with foreach
- Post Image alt text not appearing in WordPress website
- ACF gives a syntaxError unexpected token
- Using ACF on Posts Page
- Advanced custom fields if else statement
- Use Advance Custom Fields to fill text widget [closed]
- Advanced custom fields and post types
- ACF gallery & bootstrap colls and rows [closed]
- How to indicate a parent child category relationship when bulk importing
- Get ACF time in His format
- Filtering custom post admin listing page elements based on acf user field
- Parsing value from Lottie JSON file
- How do I add an ACF shortcode to a non-ACF page?
- Convert acf/gutenberg markup to html