WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] custom code to detect the URL /post and return the value (2 posts)

  1. mmartinovich
    Member
    Posted 1 year ago #

    I have this peace of code :

    add_filter('iphorm_element_value_product', 'mytheme_set_parameter');
    
    function mytheme_set_parameter($value)
    {
        // Check which post/URL we are on and return the values of the options we want ticked
        return array('Product1');
    }

    How can I find page URL I'm curently on and return that value?

    thx

  2. vtxyzzy
    Member
    Posted 1 year ago #

    If you have the ID of the post, you can use get_permalink($id).

    If not, you can use PHP as described in this article:

    http://www.phpf1.com/tutorial/get-current-page-url.html

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.