Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  3.  
  4. // Look at URL
  5. $pos1 = strpos($currenturl, "?value-one");
  6. $pos2 = strpos($currenturl, "?value-two");
  7. //...
  8.  
  9. // If URL has "?value-one" create new custom field and add value-one
  10. if($pos1 == true) {
  11. add_post_meta($id, 'my_new_custom_field_name', 'value-one', true);
  12. }
  13. // If URL has "?value-two" create new custom field and add value-two
  14. elseif($pos2 == true) {
  15. add_post_meta($id, 'my_new_custom_field_name', 'value-two', true);
  16. }
  17. // ...
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement