: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace AMPforWP\AMPVendor;
if ( ! defined( 'ABSPATH' ) ) {
function amp_get_permalink( $post_id ) {
$pre_url = apply_filters( 'amp_pre_get_permalink', false, $post_id );
if ( false !== $pre_url ) {
$structure = get_option( 'permalink_structure' );
if ( empty( $structure ) ) {
$amp_url = add_query_arg( AMP_QUERY_VAR, 1, get_permalink( $post_id ) );
$get_permalink = get_permalink( $post_id );
if( $get_permalink != false){
$amp_url = trailingslashit( $get_permalink );
$amp_url = ampforwp_end_point_controller($amp_url);
return apply_filters( 'amp_get_permalink', $amp_url, $post_id );
function post_supports_amp( $post ) {
// checking for $post->ID and $post->post_type since dynamically generated pages does not have these value set
// Because `add_rewrite_endpoint` doesn't let us target specific post_types :(
if ( isset($post->post_type) && ! post_type_supports( $post->post_type, AMP_QUERY_VAR ) ) {
if ( post_password_required( $post ) ) {
if ( isset($post->ID) && true === apply_filters( 'amp_skip_post', false, $post->ID, $post ) ) {
* Are we currently on an AMP URL?
* Note: will always return `false` if called before the `parse_query` hook.
function is_amp_endpoint() {
return false !== get_query_var( AMP_QUERY_VAR, false );
function amp_get_asset_url( $file ) {
return plugins_url( sprintf( 'assets/%s', $file ), AMPFORWP__FILE__ );