I don’t understand how this parameter works..?

Let’s see if we can break it down so it’s easy to understand. You have a PHP function named ‘cm_title’: function cm_title($text) { return ‘TESTING  ’ . $text; } It only does 1 thing. It takes what it is given, ‘$text’, and returns that $text with the words ‘Testing ‘ prepended to it. How does … Read more

Accessing GET variable named ‘error’

Your problem is that you’re using Reserved Terms. error is a reserved term, you can’t use it. To get around this, you could intercept the request early, and do a redirect, changing the query parameters in the process. For example, handling a link get parameter: add_action( ‘wp’ , ‘reserved_term_intercept’ ); function reserved_term_intercept(){ global $wp_query; if( … Read more

Delete Associated Media Upon Page / Post Deletion

Just for clarity: borrowing from this answer, add the following to your theme’s functions.php: function wpse_188427_delete_post_media( $post_id ) { $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_parent’ => $post_id, ) ); foreach ( $attachments as $attachment ) { wp_delete_attachment( $attachment->ID ); } } add_action( ‘before_delete_post’, ‘wpse_188427_delete_post_media’ ); // Uncomment … Read more

Display oembed in repeatable metaboxs using CMB2

So, to answer my own question. In the functions/backend code I made a mistake with this line: ‘id’ => $prefix . ‘media_embed’, In a repeater field it it doesn’t need the prefix and as that is defined in the parent and so it should be: ‘id’ => ‘media_embed’, And for the front end this line: … Read more