H
H
habrdima2018-05-22 14:26:09
CMS
habrdima, 2018-05-22 14:26:09

What is wrong theme functions in wordpress?

When adding functions.php to your theme, photos in the wp library are not loaded, when you save some settings, it switches to a white screen, everything is fine with the site, without functions everything is fine
wordpress version 4.9.6
functions code

<?php
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
function my_scripts_method(){
  wp_enqueue_script( 'jj', get_template_directory_uri() . '/jj.js');
}

add_action( 'wp_enqueue_scripts', 'myajax_data', 99 );
function myajax_data(){

  wp_localize_script('jj', 'myajax', 
    array(
      'url' => admin_url('admin-ajax.php')
    )
  );  

}
  ?>
  <?php
add_action('wp_ajax_my_action', 'my_action_callback');
add_action('wp_ajax_nopriv_my_action', 'my_action_callback');

function my_action_callback() {
  $whatever =  $_POST['name'];

  echo $whatever;

  wp_die();
}

what's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Way, 2018-05-22
@wayheming

Enable VP Debug and discard the error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question