Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
- // Look at URL
- $pos1 = strpos($currenturl, "?value-one");
- $pos2 = strpos($currenturl, "?value-two");
- //...
- // If URL has "?value-one" create new custom field and add value-one
- if($pos1 == true) {
- add_post_meta($id, 'my_new_custom_field_name', 'value-one', true);
- }
- // If URL has "?value-two" create new custom field and add value-two
- elseif($pos2 == true) {
- add_post_meta($id, 'my_new_custom_field_name', 'value-two', true);
- }
- // ...
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement