Facebook script wp_enqueue

  1. Please use wp_enqueue to load any external scripts/stylesheet - wp_enqueue_script / wp_enqueue_style

I should add it to function.php ?

What language should I use as default ?

Generally, you’ll enqueue scripts and stylesheets in functions.php like this:


Thanks, I know how to enqueue script … but how to enqueue FB script ? Create php files and enqueue it ?

From that screenshot I think they mean the Google platform.js. The Facebook API is called in an IIFE which I don’t think can be enqueued in the same way that that Google platform file (or other standard script links) can. It might be more appropriate to load the Facebook API like:

function yourtextdomain_facebook_api_js() {

<script>(function(d, s, id) {
   // more
}(document, 'script', 'facebook-jssdk'));</script>


add_action('wp_head', 'yourtextdomain_facebook_api_js');

But that’s probably something to clarify with the review team.

WordPress and PHP is a s… Please learn Ruby on Rails :slight_smile: