This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $to_remove = array('john'); | |
| $result = array_diff($your_array_name, $to_remove); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //escape backslash to avoid errors | |
| var escapeJSON = function(str) { | |
| return str.replace(/\\/g,'\\'); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <FilesMatch "\.(php)$"> | |
| <IfModule mod_headers.c> | |
| Header set Access-Control-Allow-Origin "*" | |
| </IfModule> | |
| </FilesMatch> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $key = array_search($item_id, array_column($array_name, 'id')); | |
| ____________________________ | |
| function search($array, $key, $value) | |
| { | |
| $results = array(); | |
| if (is_array($array)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://docs.appthemes.com/tutorials/allow-html-in-wordpress-category-taxonomy-descriptions/ | |
| // allow html in category and taxonomy descriptions | |
| remove_filter( 'pre_term_description', 'wp_filter_kses' ); | |
| remove_filter( 'pre_link_description', 'wp_filter_kses' ); | |
| remove_filter( 'pre_link_notes', 'wp_filter_kses' ); | |
| remove_filter( 'term_description', 'wp_kses_data' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $tag = get_queried_object(); | |
| echo $tag->slug | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $a = Array( | |
| 1 => Array( | |
| 'name' => 'Peter', | |
| 'age' => 17 | |
| ), | |
| 0 => Array( | |
| 'name' => 'Nina', | |
| 'age' => 21 | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(!function_exists('write_log')){ | |
| function write_log($log){ | |
| //if(true === WP_DEBUG){ | |
| $log_file_name = WP_CONTENT_DIR.'/logs/'.date('Y-m-d').'.log'; | |
| if(is_writable($log_file_name)){ | |
| if(is_array($log) || is_object($log)){ | |
| error_log(print_r($log, true)."\n", 3, $log_file_name); | |
| } else { | |
| error_log($log."\n", 3, $log_file_name); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if(is_user_logged_in()){ | |
| $args = array( | |
| 'sort_order' => 'asc', | |
| 'sort_column' => 'post_title', | |
| 'post_type' => 'page', | |
| 'numberposts' => -1, | |
| 'post_status' => 'any', | |
| 'suppress_filters' => true | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if(is_user_logged_in()){ | |
| $args = array( | |
| 'sort_order' => 'asc', | |
| 'sort_column' => 'post_title', | |
| 'post_type' => 'page', | |
| 'numberposts' => -1, | |
| 'post_status' => 'publish', | |
| 'suppress_filters' => false | |
| ); |