How to disable trackbacks and pings on Images?

Those are attachments, all items in the media library are represented as posts of type attachment in the database, that’s how WordPress knows which images/media you have and how it displays them. The media library isn’t a file/folder viewer, and this is why copying an uploads folder or putting files in there manually won’t fill … Read more

Disable popup to install app in mobile browser

I suspect this block of code is the reason: <meta name=”mobile-web-app-capable” content=”yes”> <meta name=”apple-mobile-web-app-capable” content=”yes”> <meta name=”apple-mobile-web-app-title” content=”Tarheel Trailblazers – “> Search your codebase first, your database second, for the source of that code, and remove or disable it.

wp_verify_nonce for comment form is not returning false

Instead of adding the nonce_life filter and then immediately removing it, try telling WordPress that the lifetime for your nonce is 30 seconds. add_filter( ‘nonce_life’, ‘wpse426626_my_nonce_lifetime’, 10, 2 ); /** * Sets the nonce lifetime for the creacomments nonce. * * @param int $lifetime The nonce lifetime. * @param string $action The nonce action. * … Read more

Date not working correctly

What you did wrong here is the part date(‘d’, $rem_days). The function date() should be used to convert timestamp to a formatted date, not to converting a time difference in timestamp to time difference in days. You can fix this by replacing date(‘d’, $rem_days) with floor($rem_days/86400). The complete code should be: $event_date = strtotime( get_field( … Read more

Detect whether a block has server-side render

In PHP, it’s certainly possible to check if a block type is dynamic or whether the block uses server-side rendering. For example for already registered block types, just get the block type object and call its is_dynamic method. $block_registry = WP_Block_Type_Registry::get_instance(); $block_name=”core/latest-posts”; $block_type_object = $block_registry->get_registered( $block_name ); if ( $block_type_object ) { // Note: render_callback … Read more

add_post_meta when jQuery button is clicked

WordPress Ajax to the rescue! You’ll need to open up a function in WordPress that can be called via a javascript function, which is what the WP Ajax API was built for. It’s a bit of a multi-step process, but is quite powerful once you have it setup. There’s a helpful article here that explains … Read more