Make sure everything is up to date. Go to "System Preferences" > "Software Updates". If necessary, update your system.
2. Install Xcode and its "Command Line Tools"
- Go to App Store and install Xcode.
- Open Xcode and accept the terms
Make sure everything is up to date. Go to "System Preferences" > "Software Updates". If necessary, update your system.
<?php | |
/** | |
* Remove accents from url slug before WordPress search for a post | |
* | |
* When you access page with accents you will not find any posts because | |
* WordPress is removing accents from url before saving it to database. | |
* This function will remove accents from url before WordPress start looking | |
* for post. | |
* |
<?php | |
/** | |
* Remove unwanted content from posts | |
* | |
* When your site get hacked you can have some unwanted content in database like | |
* links or script tags. This script will mass update all your posts to remove | |
* this kind of content. Take a look to $regex variable and remove or add pattern | |
* to fit your needs. To test regex you can use tool like https://regex101.com/ | |
* |
<?php | |
/** | |
* Search across all network blogs with elasticpress | |
* | |
* @param $scope string Search scope | |
* | |
* @return string | |
*/ | |
function motivast_ep_search_scope( $scope ) { |
<?php | |
/** | |
* Allow number slug in page url | |
* | |
* Since WordPress do not allow number links in url we must generate it using | |
* `wp_unique_post_slug` filter. | |
* | |
* @link https://github.com/WordPress/WordPress/blob/4.9.2/wp-includes/post.php#L3798 | |
* |
<?php | |
/** | |
* Function to save activity to log file when post is saved | |
* | |
* @param int $post_id Saved post id | |
*/ | |
function motivast_add_activity_log_on_post_save( $post_id ) { | |
$format = '[%s] Post with ID %d was updated by user %s from IP %s'; |
<?php | |
/** | |
* Redirect posts with old permalink structure to new links. | |
* | |
* If you change your posts permalink structure you should redirect all | |
* trafic from old permalink to new one. This script will redirect posts | |
* from /%postname%/ to current post link using 301 status. | |
* | |
* This script is working only for /%postname%/ => current link |
<?php | |
/** | |
* Sanitize filename to not brake links with UTF-8 characters | |
* | |
* WordPress allow to upload files with names containing UTF-8 characters. Some | |
* browsers do not handle properly UTF-8 characters in url which causes 404 errors. | |
* This filter will remove UTF-8 characters from filename before saving it. | |
* | |
* @see https://core.trac.wordpress.org/ticket/22363 Bug request | |
* |
<?php | |
/** | |
* Provide custom download link for password protected files | |
*/ | |
/** | |
* This probably should not be constant but for sake of example | |
* leave it like this; | |
*/ |
<?php | |
/** | |
* Require basic authentication for all pages except home page | |
* | |
* @return void | |
*/ | |
function motivast_require_auth() { | |
define('AUTH_USER', 'admin'); |