Use e.g. the init hook instead. For instance;:
if (isset($_GET['convert'])) add_action('init', 'yourfunction');
(Come up with a better check, though. ?convert could mean anything. And secure it by checking for user permissions, that it hasn’t already run, etc.)
Related Posts:
- login_headertitle is deprecated since version 5.2.0
- Save_post – Warning: Cannot modify header information
- Remove Actions/Filters added via Anonymous Functions
- How to restrict actions and filters “properly” by conditions
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Using add_filter() in Widgets
- Convert hyphen to underscore in permalinks
- Default or Preset Content for Custom Post Types
- How to get Custom Post ID by adding filter to child theme’s function
- How to update feed only 2-3 times a week (for Feedburner email)?
- Accepted arguments value in hook functions
- Which action hook to use for function?
- str_replace function in theme
- Modify a function without editing template
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Insert image in WordPress with HTML5 tag and caption function
- Override the WordPress core function wp_referer_field
- The_content and Preg_replace in loaded Iframe [closed]
- Insert Content Before div#main from the functions.php File
- Problem with images URL after filter applying
- New checkbox in custom widget isn’t saving data
- Modifying a WordPress Plugin
- post value to function with Ajax and jQuery
- How Do I Unhook This Parent Theme Function?
- Which method is more correct for removing WooCommerce Extensions menu item?
- How to make an If Else on Excerpt Filter
- Shortcode to eliminate and replace with
- previous_post_link inside of a function?
- Settings in functions.php used by a plugin
- child_of not working while searching
- disable a specefic sidebar when user is log out
- Remove Actions/Filters added via Anonymous Functions
- How to change form action of wp-login page with a function
- function replace_text for entire page
- How would I correctly implement a new if statement in a child functions file?
- Woocommerce custom calculation function
- add product thumbnail to checkout page only and include variation name
- Redirect specific author posts to another url
- Remove all video attachment, both files and post/postmeta from database?
- WordPress Ajaxifying not working properly
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- ACF Filter return value
- WordPress function with attribute pass to template
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Graphic before title – Specific Category
- True email confirmation for registration (keeping unvalidated users from user table)
- $content is empty while using DOMDocument
- Hide disclaimer from summary excerpts
- Replace image attributes for lazyload plugin on image elements with specific class
- Adding A New Widget to WordPress Disables the Existing Widgets
- WordPress hooks to call a function inside a construct
- How To Show Shortcodes In WordPress Custom Fields?
- Help! Need a different logo on my main page from my other pages
- True parameter but jquery register in header and not in the footer with wp_register_script
- Display page number on custom page title function
- Only seems to be displaying one child when there are supposed to be multiple
- Best way to add image to recent posts widget?
- How to replace words in my posts and saved new words
- Why might wptexturize have become re-enabled?
- Fatal error: Call to undefined function add_action() – an untouched problem
- How do I integrate my Child Theme into a Custom Template?
- Sending Messages Back to the Template After Processing?
- Pass arguments to function class with do_action()
- Search and Replace Script Loader in Head Only Works in Footer
- Regex works in regexr, but not if I filter content [closed]
- custom COOKIE on custom page
- Retrieve a custom form field modified by a filter
- functions.php filters not applied in AJAX call
- Add functionality to post editor
- custom post with loading script per single post
- What add_action reference should I be using or should I use do_action?
- Problem in outputting shortcode
- Getting error while trying to use custom comment function
- How to Add A Rel Filter to All Links?
- Print all inline styles to head
- Allow tags and attributes in post and pages content
- Override parent theme function that is not hooked or in the functions.php file
- Get Value of Custom Field
- restrict access to specific urls on a specific period of time
- How to request login for user but not for bots
- functions.php / replacing div’s with new ones?
- Can’t change excerpt length and more tag
- Why does modifying my functions.php file always result in a server error
- Function Reference for custom link in Admin Menu Management Page
- Display a list of users with avatar filterable with alphabets
- function to return comma separated list of meta values
- Force resize for all video content
- Way of getting queried loop before the query with a filter hook?
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Post variables not displaying correctly in custom function
- Custom post type functions.php if statement on action
- add query string to all pages after user logged in
- Remove snippets of JS from core
- Do something when user creates post (that’s pending)
- Filter to strip unnecessary attributes
- Trying to get this function to show below the content
- Removing Facebook contact field from user contact not working
- add variable to actions/functions across different files (woocommerce)
- How do I add functionality to images?
- Explode Array from Repeatable Custom Field