Tag: php

  • Sending data from php to javacript in WordPress

    It is often useful to send data from PHP to Javascript and WordPress gives you a method. You can use the localise script function to send data from php to javascript in WordPress coding e.g. $params = array ( “imageurl” => plugins_url(‘images/’, __FILE__), “post_id” => get_the_id(), ); wp_localize_script( ‘myScript’, ‘myparams’, $params ); and access it […]