Is there RELATIVE_PATH, like ABSPATH

You can use str_replace with __FILE__ to get the location of the current file. str_replace(ABSPATH, ”, __FILE__); So for example if __FILE__ returns: /users/chin/public_html/project-name/wp-content/theme/theme-name/functions.php The output would be: /wp-content/theme/theme-name/functions.php

ACF Pro make URL Linked in Custom Template [closed]

You echo value of the field, so you get what you do 😉 There is no way to make ACF print it your way. You have to wrap it yourself. Here’s a code that would do exactly that: <?php if ( get_field(‘svcta_contact_information_group_svcta_contact_website’) ) : ?> <div class=”svcta-contact-website” id=”svcta-id-contact-website”> <strong>Contact Website:</strong> <a href=”https://wordpress.stackexchange.com/questions/304107/<?php echo esc_attr( get_field(“svcta_contact_information_group_svcta_contact_website’) … Read more

How to remove my website link when adding a link?

You have to include the protocol (scheme), like https://. So for Facebook it would be https://www.facebook.com/examplepage. It is in this case not WordPress that adds your site URL in front of the URL, it’s your browser!

Unique one time use URL

You could add a setting using add_option( ‘access_keys’, [ ‘key_1’, ‘key_2 ] ) to check against when loading the page. add_action( ‘init’, ‘wpse339612_check_access_codes’ ); function wpse339612_check_access_codes(){ if( isset( $_GET[‘key’] ) ){ $available_keys = get_option( ‘access_keys’ ); $key_index = array_search( filter_var( $_GET[‘key’], $available_keys ); if( $key_index !== false ){ /*User has access! Delete the key from … Read more

Redirect non existing page to frontpage

You can use conditional tag is_404() and wp action hook to redirect whenever the page can not be found. functions.php add_action( ‘wp’, ‘se344018_redirect_404’ ); function se344018_redirect_404() { if ( is_404() ) { wp_redirect( home_url() ); // // wp_redirect( home_url(‘some/page-slug’) ); exit; } }

HTTP 403 Error when passing parameters to URL

I can guarantee that somewhere on your technology stack (edge CDN, Firewall, Web Server, WordPress Plugin) that you have something configured that throws a 403 error whenever you try to access a URL on your site without the User-Agent Header set. Hence why it works when you access in the browser (as this will contain … Read more

Can anybody provide me with a function to generate slugs?

This post provides a function, but it cannot handle non-latin characters. That’s because URLs can’t have non-latin/ASCII characters. Browsers might show non-latin characters to you, but it’s just a user interface feature. For example, if you visit this Wiktionary URL: https://en.wiktionary.org/wiki/わかもの#Japanese, you browser URL encodes the japanese characters to get the real URL: https://en.wiktionary.org/wiki/%E3%82%8F%E3%81%8B%E3%82%82%E3%81%AE#Japanese then … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)