Articles

Article updates

Replacing a word, sentence or anything from your Html

The also support a visual interface module easier to use, please check with this instead Replace arbitrary words from page HTML through a visual interface module.

As default the plugin offer quite many options to control HTML data through the options. Giving the complexity of environment, sometime require specific functionality to achieve desired results.

There are multiple ways to make replacements within the outputted HTML, by making direct changes within the plugin/theme which produce the code block (obliviously not preferable as in majority will break update functionality), through plugin functionality extend (see Create a custom Module Component, extending the plugin functionality), or through filters wph/ob_start_callback which would be the easiest way.

In a scenario of using a custom WordPress plugin, let’s presume it output a sentence like Powered by WordPress so we need this replaced.

The easiest way would be to use wph/ob_start_callback filter along with a custom code. This should be placed wither within theme functions.php or within a custom plugin (see Simple plugin framework to be used along with Wp Hide filters / actions and functionality extend)


        add_filter( 'wph/ob_start_callback', 'custom_ob_start_callback' ); 
        function custom_ob_start_callback( $buffer )
            {
                
                $buffer =   str_replace("Powered by WordPress" , "", $buffer);
                
                return $buffer;
                   
            }

The above code use a simple str_replace to replace all occurrences of the search string “Powered by WordPress” with the replacement string, in our case an empty text.

Preserve specific text / html block within outputted code

This functionality is available for PRO version.

The WordPress WP Hide & Security Enhancer PRO achieve provided functionality through internal filters and rewrite code. This ensure a perfect compatibility is maintained across the site without requiring to change anything at the code level or to any of WordPress files/folders structure. Any updating functionality for wither WordPress plugins/themes or custom code is preserved and it will run the same as before.

Generally, the plugin do the replacements at the end of WordPress core code execution, it will replace any occurrence of specific urls and paths with new ones which are being translated through rewrite code. In some situations, specific links, texts and html blocks are required to stay as is. To achieve that, there’s an easy approach, the specified blocks need to be wrapped up in a specific HTML comment tags:

<!– WPH Preserve – Start –>
block to preserve
<!– WPH Preserve – Stop –>

The following example preserve the content as is for a textarea field. Any matching urls and texts which will match the textarea content will not be replaced.


<!-- WPH Preserve - Start --> 

<p><textarea id="export_settings" class="code" readonly="readonly" rows="12">This is a preserved URL https://wp-hide.com/skin-nsp/images/logo.png</textarea></p>

<!-- WPH Preserve - Stop -->

Admin – Change wp-login.php

Using the WordPress as CMS to manage your website it turns into a magnet for all brute force attempts to login, from boots and hackers. On CODEX there’s a dedicated page for such topic Brute Force Attacks it’s a very sensible area of your website and should get the appropriate attention from everyone.

There are different methods to increase protection for the login page, from strong password to multiple factors protections. But still the above does not block any attempts from unauthorized, anyone can try a brute force access. Boots can do that by trying out hundred of username and password combination in a matter of minutes. Oblivious that will slow down your site and eventually the hacker will find a working login credentials.

Completely hide default WordPress login url

As default the login page your your site will be

http://-domain-name-/wp-login.php

That’s something which everyone know. How about changing to something else, a url that only you know?

New wp-login.php

 
Type in the new login page slug which will be used instead the default e.g. new-login

Per above the new login url become

http://-domain-name-/new-login

Once the login url has been changed an automated e-mail is being sent to admin e-mail with a recovery link which can be used if the new login url has been lost.

Block default wp-login.php

 
If this option is activated the old login url will be blocked and a default theme 404 error page will be returned.

wph/settings_changed

Name: wph/settings_changed
Type: Action
Arguments: $screen_slug, $tab_slug

The action trigger on plugin admin interface Settings Changed. If this action triggered there was no error and the settings where saved successfully.

Create a custom Module Component, extending the plugin functionality

As default the WP Hide & Security Enhancer WordPress plugin include many features and functionalities which should be more than enough for a regular site to hide everything about WordPress and theme / plugins related data. As the WordPress ecosystem is huge and as it getting more complex, certain aspects may become uncovered and need a bit of customization. While there is a high chance so it become available on a later plugin version, you can still extend the code and make things happen.

Rewrite – URL Slash

As default the WordPress url’s format include an ending slash. There are situations when this slash is not being append. Turning on this option, all links will get a slash if not included as default.

This is also useful when someone try to view a directory content. On majority of servers, when try to open through an url an existing directory or file, if the server configuration does not allow directory listing it will return a machine default 404 error page. But this reveals the structure directory existence, which is really not wanted. Turning on the URL Slash option, the above url returns a theme 404 error page, like there’s nothing at that link.

General / Html – Emoji

Originating on Japanese mobile phones in the late 1990s, emoji have become increasingly popular worldwide since their international inclusion in Apple’s iPhone, which was followed by similar adoption by Android and other mobile operating system.

But not everyone use Emoji. Since WordPress load the dependencies as default, it decrease the overall site speed. Disabling this will remove any code and related resources from being loaded on front side.

Disable TinyMCE Emoji This is also loaded along the WordPress default TinyMCE editor, but it can be disabled through this option.

Boot options can be used separately, each control either front side or admin editor.

Admin – Change wp-admin

Despite the flexibility of WordPress framework, there are few ways to configure the admin login url customization for making a bit safer against unauthorized access and brute force attempts. All methods are not provided out of the box through WordPress core but require custom code to make it happen.

Completely hide default WordPress admin url

As default when accessing any WordPress site through wp-admin slug it will redirect to actual login page, this is an example of url format

http://-domain-name-/wp-admin

This redirect to

http://-domain-name-/wp-login.php

But this is something which everyone know. we don’t want that, access to site management shuld be something private and definitely require a higher protection. How about changing to something different, a link that only you know about it?

New wp-admin slug

 
Type in the new admin url slug which will be used instead the default e.g. new-admin

Per above example the new admin url become

http://-domain-name-/new-admin

Once changed, the above url will be used to access any resources within WordPress Dashboard, from Posts and Pages section to Plugins, Appearance and Settings.

Block default wp-admin

 
To make the old slug totally invisible and disable it, this option can be used. Any reference to this old url will redirected to a default theme 404 error page.

Rewrite – Plugins

Within a WordPress install the Plugins are usually located within -domain-name-/wp-content/plugins This functionality provide an easy way to virtually change the path to something else.

http://-domain-name-/wp-content/plugins/jetpack/

New Plugins Path

Use any alphanumeric symbols for this field which will be used as the new slug for the plugins folder. Presuming an apps slug is being used, all plugins urls become to something like this:

http://-domain-name-/apps/jetpack/

Block plugins URL

Old url’s structure are still being available. To blow those and allow only the new links, this options need to be set as Yes.

New Paths for individual plugins

Any active plugins on the site can be mapped to use a different slug. For example WooCommerce use something like this:

http://-domain-name-/wp-content/plugins/woocommerce/

or in case New Plugins Path is active

http://-domain-name-/apps/woocommerce/

Filling in such individual plugin path will modify the urls to new slug. For example, using woo-app the updated link become

http://-domain-name-/woo-app/

Any files within the plugin will use the above url

http://-domain-name-/woo-app/assets/css/woocommerce-layout.css
http://-domain-name-/woo-app/assets/js/frontend/add-to-cart.min.js
Scroll to top