Add a drop-down selection meta field to the custom post type – restAPI seems to be bothering

I have a custom post type, name it topic, It's from BBPress, but this is not a BBPress question.

I also have a post type lessontopic,

I've added a meta-box to BBPress so I can select an appropriate topic topic for the forum topic when I'm in the backend editor for BBPress topics post meta data,

I have done the following:

add_action( 'add_meta_boxes', 'ld_bbpress_display_ldtopic_selector');

function ld_bbpress_display_ldtopic_selector() {
    add_meta_box( 'ld_bbpress_ldtopic_selector', __( 'LearnDash bbPress Settings', 'learndash-bbpress' ), 'ld_bbpress_display_topic_selector_callback', 'topic', 'advanced', 'high' );
}

function ld_bbpress_display_topic_selector_callback() {
   My call back stuff
}

add_action( 'save_post_topic', 'ld_save_associated_ldtopic',10,1);
function ld_save_associated_ldtopic($topic_id){
    if ( ! wp_verify_nonce( $_POST('ld_bbpress_nonce_ldtopic'), 'ld_bbpress_meta_box_ldtopic' ) ) {
        return;
    }
    my save stuff
}

Now everything looks fine in the backend. However, if I select a lesson topic from my meta-dropdown list and click "Update" and work through it in my debugger, the update will be executed in

wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

This has to do with the fact that for a custom block that allowed me to select forum topics, I had to enable the display of BBPress topics in restAPI, and the backend editor mysteriously encountered the restAPI update endpoint. I have activated the restAPI over

add_filter( 'bbp_register_topic_post_type', 'enable_restAPI_bbpress_topics', 10,1);
function enable_restAPI_bbpress_topics ($args) {
    $args('show_in_rest') = true;
    $args('supports') = array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' );
    return $args;
}

But I do not understand, why just checking that a post type for restAPI is visible causes the wordpress backend editor to go into a completely different operating mode? I mean, we're talking about the backend. When I activate restAPI, I can see how headless CMS, etc. should facilitate this, but why does it change as radically as WordPress handles post-processing in the backend?

Somehow this leads to my save hook ld_save_associated_ldtopic not see that $_POST Array and therefore no nonce data.

Really strange. I feel like violating a rule and it bites me, but I'm not sure what to do to make my meta-box work that way.

Ideas?

Many thanks,
Brian

php – Add a noindex meta tag to events after a certain amount of time?

We use the events calendar in my company and want to keep our old events on the website for reference. The problem is that old events are still indexed in search engines, and we end up with things like people who go or go to the flu vaccines on the wrong day because they searched and found last year's event.

The idea I've been thinking about is if I could add a conditional PHP file that checks if an event is older than 9 months, and then apply a noindex meta tag to that event. I tried to look for a code that did something similar, but it was empty. I know the event calendar has theme components, so I'm assuming I can just put something in the header of the template files. Would it be possible?

How can I add a meta?[] to my custom post type and to search terms with the rest API?

I've just begun using the rest API and would like to receive all posts that belong to a particular taxonomy and terms within that taxonomy. This part works now.

Then I want these posts to have a meta () with their fields. I found several articles about it, but the code did not seem to work. The meta () is still empty. I want all fields to be added there. I'm sure they have meta because I made it the old way and that worked.

REST API Custom Fields Revisited

https://n8finch.com/getting-post-meta-wp-rest-api/

I also noticed that the answer is an object, should not it be json?

Ajax request

Function do_make_rest_api_call ()
{
Return & # 39;& # 39 ;;
}
add_shortcode (& # 39; first_rest_api_call & # 39 ;, do_make_rest_api_call & # 39;);

Register Fields (register individual fields, I want all the fields in the meta ())

add_action('rest_api_init', function () {
    register_rest_field('verhuur', 'product', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'product', true);
        },
    ));
    register_rest_field('verhuur', 'voorraad', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'voorraad', true);
        },
    ));
    register_rest_field('verhuur', 'ex_btw', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'ex_btw', true);
        },
    ));
    register_rest_field('verhuur', 'incl_btw', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'incl_btw', true);
        },
    ));
    register_rest_field('verhuur', 'groeps_nmr', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'groeps_nmr', true);
        },
    ));
    register_rest_field('verhuur', 'bestel_code', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'bestel_code', true);
        },
    ));
    register_rest_field('verhuur', 'datum_aangepast', array(
        'get_callback' => function ($post_arr) {
            return get_post_meta($post_arr('id'), 'datum_aangepast', true);
        },
    ));
});

html – Changes a meta in the header of an already loaded page

I have an HTML file that contains only the header, with the following parameter:

header("X-UA-Compatible: IE=EmulateIE7");

It works for system-specific modules. However, on a particular page, this IE compatibility goal must be removed.

When loading the controller I tried:

header_remove("X-UA-Compatible");

It has no effect. I imagine the header has already been loaded and the page would have to be refreshed on removal. If I only update the page, I would lose the changes. Does anyone find a solution for the page to reload the header by removing the required target?

8 – Dynamic meta tags and description in custom pages

I have a custom Drupal module that generates pages for players on my site. The Player Statistics data is updated most of the time. For the sake of usability, I have created a custom module for the player pages.

I have an external database where all player information is stored. My module defines a URL pattern and displays the player's information from the external database upon receipt of the pattern.

My problem is that I was unable to display meta tags and descriptions for my player pages because there is no actual node for my pages. I tried meta tags module and meta tag route modules. However, with these modules I could only define one static meta tag and one description for my entire module, ie there is only one meta description for all pages. I want them to be dynamic and vary from page to page. I've tried the following examples, but I can only add static strings. I want the player to get a wise meta description.

Generate Meta in Drupal 8 Controller

In Drupal 8, add a meta tag to the head

Here is my code structure.

player.info.yml

name: Player Module
description: Creates Page for Player.
package: Custom
type: module
version: 1.0
core: 8.x

player.module

 (
      'variables' => ('result' => NULL),
      'template' => 'player-page-formatter',
    ),
  );
}

player.routing.yml

player:
  path: '/player/{player}'
  defaults:
    _controller: 'DrupalplayerControllerPlayerController::content'
    _title_callback: 'DrupalplayerControllerPlayerController::title' 
  requirements:
    _permission: 'access content'

PlayerController.php

 'player_page_data',
      '#result' => $result,
      '#cache' => ('max-age' => 0),
    );

  }

  public function title($player) {
    $title = "";
    /* --------------
     code logic here 
    ------------------ */
    return (
      '#type' => 'markup',
      '#markup' => $title,
    );
  }

}

I'm stuck with this topic for a long time. Every help is appreciated.

How to avoid Meta Title & description Duplicate issue?

Hello members

My website has 1000 pages for the airline route map. I am confused as to how titles and meta-description can be written, as all airlines offer route maps and the same kind of services.
The short description is almost the same

What I use

Title – Air Arabia Route Map – Air Arabia Destination & Hubs
Keywords – Air Arabia route map, Air Arabia flight ticket, Air Arabia destinations, Air Arabia hub airports, Air Arabia flights
Descriptions – Air Arabia route map and destinations are covered by Air Arabia flights. Get a complete list of Air Arabia destinations and airport hubs.

I only replace the name of the airline using the same title, description for all airlines

Title – American Airlines Route Map – American Airlines Destination & Hubs
Keywords – American Airlines Route Map, American Airlines Flight Ticket, American Airlines Destinations, American Airlines Hub Airports, American Airlines Flights
Descriptions – American Airlines route map and destinations are covered by American Airlines flights. Get a complete list of American Airlines destinations and hubs.

Please guide me, guys, is that correct or should I change it with Unique?
SEMrush

php – Clone user meta from a worpdress website to a destination website

I need to clone users from one WordPress site to another on the same server, while preserving their permissions and roles

Table creation and data cloning are fine for wp_users and wp_userdata, but when I log in with my account, I am no longer an administrator on the target site. Worked on wp_usermeta and found that the primary key and index had to be set manually so I could access the ad administrator

This is what I used (in a PHP script)

CREATE TABLE wp_userdata SELECT * FROM wp_userdata_orig

ALTER TABLE wp_userdata ADD PRIMARY KEY (ID)

ALTER TABLE wp_userdata ADD ADD INDEX (meta_key)

ALTER TABLE wp_userdata ADD ADD INDEX (user_id)

But I'm still not recognized as an administrator on the target site

I expect to log in to the target site after cloning the tables with the role I had on the source site

SELECT TOP 1 in wp_query for each group of meta value

Is there a way to use the wp_query class to execute the SELECT TOP 1 sql command while using groupby for each meta value result? I need the wp_query to select only the first of each group based on meta_value results. Can not find an example with wp_query on Google! I can only find SQL queries with get_post's WordPress feature, but I do not want to use get_posts. Any help grateful.

Thank you very much