I am trying to load a popup when click on post title in admin area and then get the data through meta query and show in popup but in console it's showing error that the js function is not defined. Looks like the file is not including properly I have tried in many ways but still the same.

I am trying to include the file in plugin name 'tasks' and the js file is in tasks/assets/js/functins.js


Here I am including the script file


 function tasks_js_file_func() {
  wp_enqueue_script( 'tasks_js', plugins_url( 'assets/js/functions.js',__FILE__ ), '', '', true);

This the function where I am creating onclick for each title

function adding_onclick_post_column( $columns ) {

                global $post;

                switch ( $columns ) {
                    case 'new_title':
                        echo'<a href="#" onclick="alert_func();">' . get_the_title( $post->ID ) . "</a>";

Try with this action called admin_enqueue_scripts It'll enqueue your js file inside of the WordPress admin area.

  • where do you live, I mean country – mohsin Oct 9 '17 at 9:13
  • can I have your contact detail ? – mohsin Oct 9 '17 at 9:14
  • I'm from Bangladesh brother. – Mahafuz Oct 9 '17 at 10:26
  • Here is my mail address : asrmahfuz8@gmail.com – Mahafuz Oct 9 '17 at 10:26

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.