General
Restricting wordpress search only for specific post type
function search_filter($query) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); // specify slug of post type instead of this ‘post’ } return $query; } add_filter(‘pre_get_posts’,’search_filter’);
Php
How to solve cross domain issue in php
Add below on the top of the php page: header(“Access-Control-Allow-Origin: *”);
Php
How to retrieve the last element in an array using php
Using end() function we can retrieve the end index value in an array: $endvalue= end($sample_array); echo $endvalue;
Jquery & Javascript
How to get the current page url in javascript
use below method to get current url in javascript: var hrf = window.location; console.log(hrf);