You might try this:
<?php
$str="This is a very large number 999,999,999.999 !";
echo $str = preg_replace( '/[^\d,.]/', '', $str );
to only allow:
- digits (0-9)
- commas (,)
- dots (.)
You might then consider filters like:
add_{$meta_type}_metadata
update_{$meta_type}_metadata
get_{$meta_type}_metadata
where $meta_type
is the type of object metadata (comment, post or user).
ps: just remember to take backup before testing these filters 😉
Related Posts:
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Individual Widgets per Page
- Add custom fields to search
- How to add add_meta_box to specific Page Template?
- Apply the_content filter to a custom field with multiple values
- Meta Query with AND & OR?
- How to get users by a custom field / by user meta data?
- Auto sort the wp-admin post list by a meta key
- Adding another state (spam, reject, approve) to wordpress comments?
- Filter archive.php by custom meta
- Get updated meta data after save_post hook
- Custom text-only header
- Add custom field to image editor
- Show User Their Password
- TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2
- How to reload the role specific registration form on validation errors?
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- Currency (price) formating on custom fields
- Adding Custom Text Area to WooCommerce Product
- Gravity Forms: Create fields programmatically
- Get multiple custom field values in a $wpdb query [duplicate]
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- Order by value in serialized custom field
- Custom image sizes for custom field media uploads
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- converting custom field date format
- List custom taxonomy terms from custom field
- Buddypress Add unserialized Profile Fields in Members Loop [closed]
- How do I create a column in Users list and display user data from custom registration field
- custom meta box text field: how to limit to alpha or numeric only
- Better Method for Multiple Meta Boxes
- Create an Array of Specific Custom Post Meta
- Possible to add a meta field for css attribute to the editor Advanced panel?
- Excluding Specific Fields from Profile Builder Registration Form
- Product Custom Fields with HTML and JS
- Add new image block, set default class name and update it using Javascript
- Add image to menu item with ACF
- Client PDF Upload (Catalogue) – Automatically update link to PDF
- How to create a shortcode to print specific values stored in a post meta array?
- How to add upload video option in wordpress for user?
- How to load an assets based on custom field value?
- Adding auto-complete to custom gravity field not working
- Set post to unpublished after one week depending on condition
- Search in Archive Pages by subcategory, tag, custom field and year
- Custom WP_Query for WordPress Search Results with meta_query
- Change order of posts
- Meta Query And/Or
- URL Rewrite fires when retrieving a custom value?
- How to store post meta in an array
- Get image url using image id
- Set checkbox as checked by default in a metabox
- ACF form edit front end post title does not change permalink
- How to list Category list in ACF Pro’s Select Field to choose from [closed]
- Can I use a Custom Field as the Featured Image URL?
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- Is it preferable to use custom code to create metaboxes instead of plugins (such as ACF) and if so why? [closed]
- Function that replaces the image in the absence of the post meta
- check for duplicate user meta data before updating
- WP Cli – post add meta in xargs after wp post generate – add multiple fields
- Anyone know how to use ACF and show custom fields for logged in users only on a post? [closed]
- How to redirect to home page according to a specific page custom fields value and user name
- Is there a way to dump all registered sidebar/widget?
- ACF Plugin How to make the customer add more fields in the post?
- custom field in admin columns
- Custom metabox not working
- get_post_meta returns 0
- Populate wordpress menu with link to custom field value (file download)
- Selectively hiding or allowing thumbnails of featured images on front page
- Users uploaded image and matching an id or taxonomy
- Adding data to User profile
- How can I change author of posts to the value of one of the custom field of the posts?
- Let any visitors delete a post if they know Id nr & password?
- Is it possible to add Term Meta Fields to a WooCommerce Attribute?
- update a custom field with the value of another existing custom field
- Post meta data not showing in frontend, until hitting ‘update’ button
- register_form, custom field not submitted on first try
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- How to properly get popular Posts by multiple Values
- Echo out custom fields in comments
- Query Custom Fields in Searchform
- Make custom user_meta as permalink for post
- Creating Structured Documents (books) in WordPress?
- Filter query based on date in custom field
- Get custom fields when hover link of post
- Convert all dates in field to Unix time, except those already in Unix time
- WP Query multiple select form – meta_query help
- update_post_meta not working in action hook
- Group pages by custom field values
- Convert many posts from having a specific meta_key to use a post_format
- Custom fields: my custom checkbox area doesn’t seem to work
- get_post_custom_values not working
- How to check if custom field exists in this widget query
- display loop only if a post meta data exist
- Check if a field is capitalized?
- Need to call this php function inside a modal window from text widget
- add multiple values (array) to post meta_input
- Assign class to Drop Down Selections in WooCommerce Products Custom Fields