My plugin uses the code below that has uid="x" in it that requires the user to edit the plugin and set "x" to their user id, such as uid="420971". Whenever I release an update to the plugin and the user downloads it, the update overwrites this setting because the update has the generic u="x" in it. How can I save the user's personal uid and apply it to the updated plugin?

add_filter('the_content', 'the_plugin');

function the_plugin($content) {
  global $add_the_script;

  $content_add_on = '<div class="ACME_STATS" uid="x"></div>';
  $theContent = $content.$content_add_on;
  $add_the_script = true;

  return ($theContent);

Store the uid in an option. Use the Settings API to create an admin page to manage the option.

  • The keywords "option", "settings API", and "admin page" tapped into good examples from WordPress and Google. Thanks. – Guessed Oct 6 '15 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.