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
- Plugin question, How to insert a colon in a value box
- Include theme header and footer in custom plugin
- How to fetch WordPress Gallery Images to a Custom Post Type?
- Remove H1 title in admin post edit screen
- PHP Fatal error: Cannot redeclare distance() when making a new block
- How to Display News in a Timeline with Headline, Category, and Time?
- Query Custom Post Types on Available Dates
- How to customize user search
- unzip a folder on specific location and delete the zip file
- custom taxonomy and custom post type url conflict
- Upgrade Private Plugin without Deleting
- Passing $this->get_field_name() to javascript
- Placement of Code in Plugin for hooking `save_post`
- Handling jQuery Component Collision
- publish_post plugin hook doesn’t always pass $post->post_content
- Loop with array of posts using ‘Advanced Custom Fields’ plugin [closed]
- gallery option is not available in media upload box in costum theme option page
- Multiple files in a plugin
- Custom height/width for thickbox in WP Backend
- add action wp_head not working
- Many plugins making WordPress run slow by design?
- Hide Theme options and Customize Admin menu
- Using ACF to display data on all pages
- How to make my plugin GDPR compatible?
- Wp die causing 500 Internal Server Error?
- Why is the Settings API is not saving my array of options
- Override comments.php template with plugin
- Current user in plugin returns NULL
- Do you clean up your self-written plugins’ at deactivation?
- Variable from a plugin into a theme
- What are the benefit in adding hook in the init() hook?
- Is it possible to set up multistore in Woocommerce? [closed]
- Why was my plugin rejected from the WordPress.org repository?
- Hidden Custom Post Type
- Upload file inside plugins options page
- Is there a way to programmatically enable a plugin?
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- $wpdb working with ajax but showing ajax error instead of success
- Custom Post Type | Fatal Error on register_post_type()
- How to make first_name and last_name required fields in user profile?