The custom post type is being register as name, not snippet as is being called in add_meta_boxes action. This is because a PHP var is passed inside single quotes and it is not being interpreted.
Change this:
register_post_type('$name', $args);
To:
register_post_type($name, $args);
This also work:
register_post_type("$name", $args);
But never pass PHP variables inside single quotes if you want they be interpreted.
Also, it is recommended the use of add_action('add_meta_boxes_{post-type}', 'callback') to create less unnecessary hooks for other post types (from codex).
Related Posts:
- How to change default position of WP meta boxes?
- Custom Taxonomy as checkbox or dropdown
- Multiple Custom Metabox Help
- Why won’t my metabox data save?
- wp_dropdown_categories in custom post type with custom taxonomy
- How can I add a column/s to wp_posts table?
- echo value from ‘select’ field type into page template using cmb2?
- WP_List_Table Inside Metabox Not Working on Submit
- Custom post type metabox array
- Add metabox with media uploader in a custom post type [duplicate]
- Remove tabs from media uploader for a CPT
- Find callback function for custom taxonomy metabox
- Remove custom metaboxes from custom post type
- wp_generate_attachment_metadata gives me an empty array
- Best way to arrange custom post types by Attributes -> Order metabox value?
- Add special meta box to custom post type
- Removing Edit Permalink/View “Custom Post Type” areas
- Unable to save custom taxonomy terms in a custom-built metabox
- Custom field values get deleted
- Order custom posts by a date metabox
- How to sort CPT by custom meta value (date), and return posts month by month
- Priority of Meta Box for Custom Post Type
- Undefined index: at_nonce in custom post metabox
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- How to save the checked boxes?
- Adding Custom Metaboxes to Custom Pages
- Possible to add meta box to edit.php pages?
- add_meta_box: Datepicker like the one for postdate?
- How can I include meta box content when searching?
- Save or update data when custom post published
- update a post meta from a single table cell TablePress
- Custom metabox translation
- How to create a repeatable / reusable divs in the metabox?
- Custom Post Type Meta Boxes
- wp is not defined error using wp.media to create a custom image uploader
- How to add multiple featured image in meta box in post editor?
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using WPAlchemy metabox values in another metabox
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- Hide Meta Boxes for Non-Admins
- Adding Meta Boxes while Registering a Post Type in a Class
- How can I display my custom metaboxes on a custom post template?
- Custom Post Type with metaboxes (no content) only?
- Dynamically add / duplicate custom meta in custom post types
- Add TinyMCE to CPT metaboxes in 3.1?
- Custom Post Type Metabox – Not Saving
- Unable to show meta box data in frontend
- How can I create a custom meta box to add an mp4 video to a page?
- advanced search forms with 3 input text and that the main problem 3 input text
- List of Posts in a Custom Field
- Using My-Meta-Box-Class plugin, how is ‘Date’ value stored?
- Pull a post based on a meta value in a custom post type
- Change meta box when the page’s template is changed
- Cannot save Checkbox meta box value from a Custom Post Type
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Undefined Variable – Custom Post Type Meta
- Keep display metadata value on backend – Custom Metabox
- Populate dropdown from one custom post type inside another custom post type
- Why is my select meta data not saving?
- Add Standard Page Attributes Metabox for Page Parent
- Custom date changer post_date => future – missed schedule error
- What is the best way to correlate one-to-many content-type relationships?
- Is it possible to create relational metabox values in a custom post?
- Changing custom type name hides the posts
- Visual editor issue by having multiple tiny mce editors in a CPT
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Anon function and add_meta_box
- Metabox not show in categories custom post type cmb2
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Display correctly using metabox.io
- pre_get_posts for custom page builder meta box
- Show Custom Post Type meta boxes only on Page Edit
- How to make custom taxonomy into drop down select in a custom metabox
- Adding Page Templates to post but it ignored it
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Translating custom post type metaboxes [closed]
- Fixed values for same post translations
- How to Add multiple instance of meta box to custom post type
- Using POST method in meta box, no results
- Checking if $_FILE isset for an array of file upload metaboxes
- Ordering values entered in Custom Taxonomies
- Permalinks: custom structure for taxonomy – tags?
- Custom Post Type & Meta Box – Displaying meta box information on front end?
- How can I move (or create another) publish button?
- Wrap meta boxes & data handling for specific post types in classes?
- Custom “radio button meta box” not saving correctly
- Global custom meta box
- Sizing textarea field in custom metabox
- Meta Data for Custom Post Type not saving
- Remove “show sharing buttons” metabox Jetpack from custom post type
- Custom Post Meta from custom metaboxes is randomly being deleted
- Add a custom meta box for client to order CPT posts how they want
- Use remove_meta_box conditionally on custom post type
- create custom meta box with default value
- Custom post-type metabox position
- Issue on Working with Metabox – Checkbox to enable Sale Items