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:
- Multiple Custom Metabox Help
- wp_dropdown_categories in custom post type with custom taxonomy
- How can I add a column/s to wp_posts table?
- Remove tabs from media uploader for a CPT
- Find callback function for custom taxonomy metabox
- Remove custom metaboxes from custom post type
- Add special meta box to custom post type
- Custom field values get deleted
- Priority of Meta Box for Custom Post Type
- 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
- add_meta_box: Datepicker like the one for postdate?
- Save or update data when custom post published
- Custom metabox translation
- Custom Post Type Meta Boxes
- 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
- Adding Meta Boxes while Registering a Post Type in a Class
- Dynamically add / duplicate custom meta in custom post types
- Custom Post Type Metabox – Not Saving
- How can I create a custom meta box to add an mp4 video to a page?
- List of Posts in a Custom Field
- 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
- Undefined Variable – Custom Post Type Meta
- Add Standard Page Attributes Metabox for Page Parent
- Custom date changer post_date => future – missed schedule error
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- 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
- How to make custom taxonomy into drop down select in a custom metabox
- Translating custom post type metaboxes [closed]
- How to Add multiple instance of meta box to custom post type
- Using POST method in meta box, no results
- Ordering values entered in Custom Taxonomies
- Permalinks: custom structure for taxonomy – tags?
- Custom Post Type & Meta Box – Displaying meta box information on front end?
- Global custom meta box
- 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
- Issue on Working with Metabox – Checkbox to enable Sale Items
- wysiwyg editor don´t export paragraph
- How to make a meta box?
- Forms and WordPress Nonce
- Why do I have to press the “Update” button twice to save my meta box values?
- Inefficient Query Confusion
- Prevent custom post type from showing up in custom menus
- link featured image to external link
- Odd behaviour for the update button when displaying a WP_List_Table
- Creating alternate meta box context locations
- Showing a meta box in a custom post type on a page
- Having Issue on Getting Metabox Checkbox Value
- Custom meta box in custom post type not working
- Multiple wp_editor instances in custom post type using Ajax
- WP_Meta_Query object with conditionals
- I can’t connect my custom jquery to wp admin
- Saving meta box data?
- Updating post content and custom fields in edit post screen
- Add a class to post_class if more than one post shares same meta_value_num
- Function to return values from metabox
- Invalid file type when using wp_upload_bits to upload PDF to a custom post type
- Add a meta field to the list of results for a custom post type
- List of all posts in one custom post type in the edit screen of another
- Create a custom post type based on ‘Post’
- How do you make relational post types in WordPress? [duplicate]
- Placing Admin Post Metaboxes in Tabs
- Wp Meta Query does not work while simple Query Works
- How to Grab Anime info using Jikan API and fill the value in Metabox
- create a “add icon” field in taxonomies page
- Problem with multi checkboxes value in metabox?
- Getting data from dynamically allocated metaboxes within a custom post
- Get meta values from parent post and save in child post
- Using meta boxes as the title of a custom post type
- check_admin_referer not working in custom meta box for custom post type
- Custom meta box in editor of custom post type not working
- Meta box not saving
- CPT and metabox: create multi checkbox by using array?
- How to make post page unique and show it on home page?
- Default taxonomy ‘post_tag’ added to CPT managing by custom role : nothing in the metabox
- Add different meta box based on taxonomy
- Custom sortable pages on custom post type
- Toggle a metabox based on a selection
- Add multiple custom meta boxes to different custom post types
- Custom post type Featured Image popup not working
- Need to build custom metabox select prev posts by category
- How to bring custom meta boxes to custom post types?
- Problems with a custom meta_box
- Customized featured image doesn’t refresh in post admin metabox after upload/insert
- Saving custom metabox data with a twist
- Canot save post if any meta box was empty
- How to consume external API from WordPress post editor and display the response data in the custom field?
- custom post type with metabox custom fields