Your code is fine to me, except you made a mistake here:
template_redirect('/product/channel-mcgilchrist');
WordPress does not have a function named template_redirect
, only a hook with that name.
So you should have used either wp_redirect()
or wp_safe_redirect()
which are valid functions to perform URL/page redirections in WordPress.
wp_safe_redirect( '/product/channel-mcgilchrist' );
Related Posts:
- What is an alternative method to the WordPress private _doing_it_wrong() function
- Understanding WordPress functions’ naming conventions
- What function to hook for changes made in status and visibility of a post
- Change template dynamically
- Can I change header.php of current theme through a plugin function?
- Apply styles to blockquote element with the WYSIWYG editor
- Change the behaviour of a button
- Override category archive page title (not the head title)
- redirect_to how to make it simply work with get parameter or similar?
- WordPress permalink setting
- How can I add recent posts to menu like mashable
- Which hook should be used to add an action containing a redirect?
- Why does WordPress add 0 (zero) to an Ajax response?
- Where to store PHP files created by plugin / themes
- function deactivate_plugins does not exist
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- How do I Make a Theme “plugin-ready”?
- How to Add a .js file Only in one specific Page Dynamically to Head
- How can i list current author’s categories?
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Add new user and add meta at once
- Custom user profile, registration, login page with theme
- Problems with removing admin bar
- What is the Difference between directly call a function and call a function using add_action?
- What is better way to use Bootstrap inside admin panel?
- Call to undefined function get_blog_option()
- Undefined function wp_set_password
- What’s the better way to add an inline script?
- Plugin Uninstall and Deactivate via Options Menu
- What for the tables ending with the meta used in database of wordpress?
- How can I add a CSS rule to edit.php?
- Finding the paragraphs in content
- Is Dreamweaver CS5 a serious choice for theme/plugin development?
- What allows a template file from plugin to be copied in child theme and overridden?
- How to avoid loading same script twice?
- Can I individually style items in the backend widget list?
- WordPress security issue to output data from user input from theme option form
- add more custom post types and custom role to the code
- Customizer: widget-synced triggers twice
- Change the ‘published on’ text?
- add_rewrite_rule works in themes function php but when moved into plugin it stops working
- Where can i find wordpress auto update code flows?
- Is there some way to provide the user a list of existing content in a CPT
- Change the look and feel of admin pages
- How to access noticeOperations from withNotices
- how to search users by ajax live search
- How to get boolean value from register_meta properly?
- Remove unwanted elements for a wp_nav_menu
- What is the proper method of using global $post?
- How to export post meta with images in wordpress
- Password field is empty when using wp_signon();
- How to change title tag at page after loaded post?
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- WordPress custom taxonomy check box to dropdown
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Widget HTML Display Problem
- Checking for existence of a page by title?
- how to get context information inside my funcion
- How to create a backend for a custom theme?
- wp_nonce_field displaying twice
- How to modify files inside wp-includes directory in wordpress
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- wp_get_post_terms Order by not working
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- WP Plugin Running before jQuery
- Autogenerate a Table of Contents
- my own SVN for a plugin/theme
- Why enqueue styles on hook?
- WordPress multisite,use same cookies across all website?
- Proper way to use useSelect
- unregister_setting() vs delete_option() for plugin update
- How to redirect to login page when user not loggedin on a particular page
- modify show UI of a registered taxonomy
- Using function from enqueued .js file in theme in plugin?
- Using HTML links within translatable string
- How to resize WordPress images on upload to specific height and width without cropping it
- WordPress Page Reload Takes forever during theme development
- Adding tables to dashboard pages programmatically?
- Anyone using unzip_file successfully? It uploads the zip but doesn’t extract it!
- WP 3-way voting system: On to something! Please help!
- Include external po file for 3th party plugin to theme
- How do I add filter with woocommerce categories?
- Add New Button in Admin Panel
- Can’t upload image via submitting custom post from frontend
- Need Help to make a logic for editing posts in Frontend
- How to hide/remvoe unnecessary field/section in post edit section ( Dashboard )
- Determine if the current page, is being edited
- Is it possible to modify an Elated plugin portfolio-list template in such a way that it will not conflict with future plugin updates?
- Woocommerce Custom Checkout
- Looping single post in a theme
- Custom theme and plugin updating
- Dynamic banner for use on external sites
- problem with blank page
- grouping my widgets wordpress
- How can i call from custom fields to the category editor?
- Why does this fail: Disabling plugins enqueue_script() in functions.php
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]
- How to add something after a function
- how many rupee or dollar charge to client to make theme [closed]