Last active
July 14, 2023 21:26
-
-
Save 8ivek/40a8a3f536dae66eb6a667d32a2356cc to your computer and use it in GitHub Desktop.
run one time code in Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// running one time script in wordpress | |
function oneTimeFunction($arguments) | |
{ | |
// One time task goes here | |
} | |
add_action('wp_loaded', function () { | |
if (isset($_GET['unique_argument_xx007']) && $_GET['unique_argument_xx007'] === 'unique_value_xx007') { | |
if (!get_option('random_option_xx007')) { | |
oneTimeFunction($arguments); | |
add_option('random_option_xx007', 1); | |
} | |
} | |
}); | |
// calling: | |
// https://yourdomain.com/?unique_argument_xx007=unique_value_xx007 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment