Not a direct answer, but two suggestions.
First of all, get_last_numero
does not necessarily return the highest number. It returns the last one. If you have full control over insertion then it will be no problem, but once you will do an import, or change things in the database manually or in other ways than the usual, you might introduce problems. So, in your get_last_numero
function, you might want to sort on that (meta) query value DESC. ACF has a function for meta queries to sort numerically.
Second, get_last_numero() + 1
might seem to work, but you’re adding a string and a number, which is not a good thing to do. PHP will figure it out in most cases, but since ACF will return a string for a field and you know that, you could cast your return value to integer by preceding the value with (int)
, so return (int)$numero
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Custom media upload content for inserting custom post shortcode
- Redesigning Custom Post Type “Add New” page
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- Creating a default Custom Post Template that a Theme can override
- How to load a new template page according to a particular URL?
- How to get the custom page get_permalink?
- Updating post meta for custom post types
- remove custom taxonomy metabox form custom post type
- Custom Post Type Statuses
- How to Build a Movie Library in WordPress 3.x
- Get image URL from media library in input
- Way to hook into a sidebar call to replace it with a custom sidebar
- WP_Query ordering numbers as letters
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Is it possible to create Custom Post plug-in?
- Using a post-signup hook to get user details
- Matching Chapters to a Custom posts [closed]
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- Making a Template for a CPT created by a plugin
- Unable to delete custom post types, confusion around capabilities
- Adding CSS to custom post type admin page causes error
- ACF: post query, hide duplicate values [closed]
- Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- Adding custom meta boxes to specified custom post type
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Preview with Custom Post Type Not Working
- Plugin generated unexpected output – No PHP errors
- Custom Post Type template for homepage
- Custom Post Type, Custom Columns List
- How to create repeater field manually, without plugin (ACF Pro)?
- Need to edit author permissions | custom taxonomy
- Is it possible to pin a post in second position from top
- How to get the custom field value using SQL query
- Setting Author on CPT
- Check if theme supports sidebar
- How to display the category name in the tab and post inside the tab in WordPress?
- custom post type plugin error [closed]
- How to display the custom post related blog by category?
- Problem with checked box on wp car manager plugin
- Ultimate Members Default Post Layout problem
- custom post type get_posts() function not work
- Create multiple posts when a custom post is created
- $wpdb->insert not working inside save_post tag
- Cannot view Custom Post Type no matter what I try
- Add Custom Field to Post Pages via Plugin
- plugin_dir_url(__FILE__) searches parent theme in ACF extension
- How to add jquery to my custom post type wp plugin
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- get_option include in my adsense
- Making a Custom Post Type Publish Loop
- Is an Office a custom post type [closed]
- Wrong block appender button showing
- How to access the page without registering in wordpress
- CPT template is not being automatically used single post pages
- How to make content as required in custom post type?
- public custom posts not showing in my wordpress plugin
- How to provide page_template path in custom plugin using WordPress
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- Which method is best to enqueue scripts
- WordPress Capabilities: edit_user vs edit_users
- Is there a WordPress Plugin that allows voting “does this coupon work” on specific links like Retailmenot
- Force plugin to fail activation
- Custom Post Type | Fatal Error on register_post_type()
- Dynamic CSS Vs Inline Issues in Code any Way around in a WordPress Themes?
- Is license need for free wordpress plugin
- Getting a List of Categories for Use in a Plugin?
- custom post type not showing in menu
- Building plugin with changeable custom post type values…advice needed
- How to get all of the activate_plugin action parameters?
- What can be reason for no plugin-strings available under stable section on translate.wordpress.org?
- WP_Terms_List_Table Quick Edit not working
- Is there a directory my plugin can write files to that cannot be viewed via the browser/url?
- How to add custom table style for table block in gutenberg editor
- Issues with a WP plugin menu system
- Add a “View all” button on WooCommerce product archives pages
- How do I add an options page at the bottom of the list?
- How can I list custom post type categories of portfolio
- A question of etiquette when forking a plugin? [closed]
- how to request a script more than once in wordpress
- How to log custom plugin error to debug.log file
- How to create admin setting for this small plugin
- How to fix caching issue in PHP data from database
- Adding shortcodes to multiple pages with function
- SASS not showing in customized preloader plugin
- How to securely controlling data without keeping it in postmeta?
- Get a list of Product Categories inside a loop
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- wordpress ajax pagination object value does not change
- Google analytic issue in wordpress
- Custom pages with plugin
- What’s the preferred method of writing AJAX-enabled plugins?
- wp_update_post call really slow when official Facebook plugin is installed
- How to set-up multiple cron task with wp_schedule_event so that they do not overlap?
- Plugin version number after code rewrite [closed]
- is_user_logged_in() undefined at shutdown in plugin context
- What are Seeds? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode