There are two problems that I can see that cause your code to fail.
The first is that you’re using update_page_meta, which does not exist. Use update_post_meta
instead.
The second is that you’re using the action save_page
, which also does not exist. Use save_post
, save_post
is an action triggered whenever a post or page is created or updated, so it is appropriate to use in your case.
For an overview of actions that you can use, see Action Reference
Related Posts:
- Why isn’t is_page working when I put it in the functions.php file?
- Get the ID of the page a menu item links to?
- Disable visual editor on one specific page
- How can I programmatically create “child” pages on theme activation?
- How to display error messages using WP_Error class?
- Slugs as breadcrumbs for Pages
- Check if has any sidebar active on current page
- Remove Page Title from Static Frontpage
- Target a certain page within wordpress backend (admin) i.e. Pages > About
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- Pages should have priority when using add_rewrite_rule
- Enqueuing Script in functions.php vs on the page
- Programmatically set page template based on page ID
- Delete pages and Create default pages for all new network sites
- how to change link of some wordpress pages
- Make menu structure match page heirarchy on page parent change
- Change the slug of a particular page every x hours
- wp_insert_posts keeps adding multiple pages
- How to include local menu based on page id?
- Batch update menu_order attribute alphabetically
- is_account_page() change to page slug
- Don’t delete a page if it holds users
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- Display post shortcode content in the sidebar?
- Why is my page feed returning empty content?
- Function only on a specific page
- Functions For Calling Specific Elements
- Get page id or status by private pages?
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- Enqueue script on every page except one
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- How do I register a new settings page? [closed]
- Only echo Page Content (not page title & page content together)
- get content from page through AJAX
- How to assign php file(template) to several pages with same prefix page name/slug
- Remove the delete link from pages without a plugin
- Change is_front_page() to is_page() to display ‘hero’ on entire site?
- Define an extra field for all pages (with no plugin?)
- Using array page name together with page id to deregister script
- How to add a class name to the ancestor of a post?
- How to add an excerpt and read more link to a page?
- My website is generating weired url parameters of paginated pages
- How to get the image EXIF date/time and use it for the WP post date/time
- Programmatically Set First Image as Featured
- add_action in a function, is it possible?
- How to manually activate user in dashboard only by admin
- In WooCommerce I need to modify the thankyou.php page [closed]
- When is wp_trim_excerpt() called?
- How do you completely remove the default header and footer using functions.php?
- Allowing SVG uploads in media uploader without plug-in
- Ajax call theme functions from front
- Show excerpt for only first post in query
- Members only site – still need the lost password page accessible
- Load JS Script only for custom post types
- How to overwrite / extent wordpress function is_email
- WordPress upload_mimes not working for front-end uploads of 3D files
- Removing permalink from post thumb in twentyeleven
- Product object returns no sale price
- How to stop twenty fifteen theme from cropping featured images?
- How to know if user logged in
- Option Tree integration of Custom CSS
- Can’t call Javascript function – scope?
- Deprecated function get_user_by_email($email)
- header_image() with CSS
- Shortcode parse error – wrong syntax
- disable Tab post on nav-menus page (Admin)
- Load custom css in functions.php causing library issue
- In jquery use php variable to execute an enqueued jquery file
- Run a jquery script on on a certain template page
- Can’t add_action to ‘save_post’ and get it to fire
- How to load jQuery in TOP of wp_footer?
- How to fetch custom post type by variable date?
- two search forms on the same page
- Getting out side of wp root folder from function.php using absolute path
- Include Jquery libraries in wordpress theme?
- Change default upload images size for contributors
- Strange error from functions.php files (wp_register_script)
- Retrieve First Image Function
- file.php not loaded?
- How to setup a popup registeration page in wordpress with function.php
- Display ACF category image on archive and single template files
- Auto delete content in specific folder inside media library
- Using get_terms for custom taxonomy in functions.php
- How to update an image attachment’s alt text from a custom field when saving a post?
- Allow user only create specific tags
- Child theme remove parent filter in functions
- How to display different blocks for mobile and desktops
- WP Enqueue Script Error
- Enqueue JS + CSS via a child theme functions.php file?
- How to add publish/draft button in Admin Post Lists
- How to add number to wordpress count function?
- How do I integrate my Child Theme into a Custom Template?
- Sending Messages Back to the Template After Processing?
- get USER ID in functions.php using user_register action
- WPDB function not saving
- trouble with passing class method data to outside function
- Insert Shortcode exactly at the end of the content
- preg_replace specific Text to small latter strtolower [closed]
- Trying to decipher this code which is encoded with HTML Special Characters [closed]
- Which action is triggered before final output?