CMB2 not working in my WordPress theme

Change $prefix = ‘_yourprefix_’; to $prefix = ‘_wp’; or add the code below directly to functions.php add_action( ‘cmb2_admin_init’, ‘register_testimonial_metabox’ ); function register_testimonial_metabox() { $prefix = ‘_wp’; $cmb_demo = new_cmb2_box( array( ‘id’ => $prefix . ‘metabox’, ‘title’ => __( ‘Homepage Custom Fields’, ‘cmb2’ ), ‘object_types’ => array( ‘page’, ), // Post type ‘show_on’ => array( ‘id’ … Read more

display connected User to post

That code retrieves the information, it doesn’t do anything with it. you have to echo out the data, expect $users to contain an array of WP_User objects e.g. $users = get_users( array( ‘connected_type’ => ‘multiple_authors’, ‘connected_items’ => $post ) ); foreach ( $users as $user ) { echo ‘<p>’.$user->name.'</p>; }

How limit user connection?

There is no foolproof method to do this, and I would note that you will not be able to cache pages for performance if you try this Force The User to Only be able to open a single page, no tabs, no other devices/browsers This isn’t possible, and the few measures that try to do … Read more

how to make wordpress plugin from PersianWebToolkit? [closed]

It sounds like you need an introduction to plugin development. As in all things WordPress Development, the WordPress Codex is the first place to look. Here is the Plugin Development information: https://developer.wordpress.org/plugins/ But you will need some PHP programming knowledge. Here’s one good place to start: https://www.w3schools.com/php/default.asp . And the googles have plenty of information … Read more

Loop returns the current page’s permalink and guid instead of the post in the loop

I’m actually surprised that your code is working. There are several typos in it that should be throwing fatal errors. global $post; $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘post’, ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : ?> <?php $the_query->the_post(); $id = get_the_ID(); ?> … Read more

Hide a certain category name from Related Posts

$d = get_the_category(); $glu = []; foreach($d as $rst ): //exclude category name if($rst->name != ‘Sticky’): $glu[]=”<a href=”https://wordpress.stackexchange.com/questions/276556/.get_category_link( $rst->cat_ID ).”>{$rst->name}</a>”; endif; endforeach; //error_log(print_r($glu, true).’/n’, 3, WP_CONTENT_DIR.’/debug.log’); echo “These are the categories”. implode(‘, ‘, $glu); I’m a beginner. Hope this will help!

wp_insert_term() doesnt insert a term

Thanks to Milo who asked an important question: Where is this code? I put it below where ive have registered the taxonomy and then it worked: function register_taxonomy() { $labels = array(…); $args = array(…); register_taxonomy( ‘ncategory’, null, $args ); $parent_term = term_exists( ‘Gender’, ‘ncategory’ ); // array is returned if taxonomy is given $parent_term_id … Read more