Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [id]

A unique identifier.

0
votes
0answers
19 views

Wordpress user ID prefix

Anyone know of a way to add a prefix to the WordPress user ID when the user registers via WooCommerce checkout? This new user ID format would need to be stored in the WP database in the default user ...
0
votes
0answers
21 views

Wordpress Post IDs are not incrementing when Add New

I have a dev site and a production site and this is only a problem on production. This happens whenever a new post or custom post type is created from the "Add New" button. If they are created ...
0
votes
1answer
28 views

get_post_meta not working with variable as a post_id for dynamically get the postid

I would like to use the get_post_meta to pull a value from a CPT dynamically and then send a email. The problem is that the get_post_meta($post->ID, ... part of the code does not pull the email ...
0
votes
1answer
34 views

Get attachment URL from attachment Link in WordPress

I have been trying to fetch the URL of image attachments ( e.g. - http:// localhost/mytheme/post-format-gallery/100_5478.jpg ) using their attachment links ( e.g. - http:// localhost/mytheme/post-...
1
vote
1answer
84 views

Fetch ID's associated with a custom post type when translated with WPML?

I've created a custom post type (roomtype). Now these roomtypes has post id 272 (single room in swedish) and 350 (double room in swedish) I've made it translatable (with WPML) and created in english. ...
0
votes
0answers
126 views

How to get next post ID?

Here is get_next_post function. But it gets next post only in main query. I want to get next post id by current ID. ie. my current id is 456 and get nextPostId('456') it must return 457 Is it ...
0
votes
2answers
49 views

Is there a better way of retrieving the name of an acf pagelink type from current post?

I'm using Advanced Custom Fields. I have a registered bookitall_roomstype custom post type. I have a registered bookitall_bookings as another custom post type. In the bookitall_bookings there is a ...
0
votes
4answers
536 views

Get post / page ID from ACF Link field

I'm trying to recieve post ID from link using ACF link field: <?php $link = get_sub_field('offer_link'); $id = get_the_ID(); if( $link ): ?> <a href="#post-<?php echo $id; ?&...
1
vote
1answer
93 views

How to get user_id from wordpress database inside ajax function?

I have an ajax function which switches the view type of the user's posts from list mode to grid mode via ajax but the problem is that when the wp query is being called it can't get the id of the user'...
0
votes
0answers
29 views

query posts based on a custom field matching current post id if custom field has multiple values

OK- so here's the scenario. I have a custom post type (events) and another (speakers) and i'm trying to automate the relationship between them as follows. in the 'events' post type i've used ACF Pro'...
0
votes
1answer
28 views

Get users between user ids

How select users between 100 and 200 user ID's? Or select users which ID less then 200? $args = array ( 'query' => array( array( 'key' => 'ID', 'value' ...
2
votes
2answers
373 views

Undefined variable post_id in custom quick edit coloumn

I am trying to add a custom coloumn to post quick edit and everything is almost working. Custom meta is saved and passed but if I click on quick edit the preview is blank. This is the error it gives ...
1
vote
2answers
36 views

Check if someone recently commented in one of my posts

Is there a wordpress function like - If someone recently commented in one of my posts (not other author post), I want his/her ID? If there is no function like that, how can I achieve it? ...
0
votes
0answers
39 views

post_id takes page_id / index.php into page-home-php / CherryFramework Parent-theme

Background Info: parent theme: CherryFramework version 3.1.5 child theme: theme50113 version 3.1.2 So I have a Homepage and added some content with the "Text-Editor", I want to have the Blogpage in ...
0
votes
1answer
35 views

How to I retrieve the ID from the Posts page?

I am creating some custom meta boxes in my theme to allow user to insert their own custom meta description and keywords overrides (no I will not use a plugin for it). I am having an issue with the ...
0
votes
0answers
15 views

send page ID's to another template

I have created a page called Projects. I then created 4 pages that are children of the projects page. I have some code that creates a link on all of the children pages that when clicked, will take you ...
0
votes
0answers
17 views

Add a CSS ID to the header of my page

I want to add an animated background to the front page of my website, so I use the following plugin, but the problem is that i must apply an id to the body and I don't know how can i do it in the ...
0
votes
2answers
29 views

Making (and edit existing) posts with ID included

I've got lots of posts with the same title (home estate's properties), and i need to make url of single property -> title + ID (id part, adde automatically) after making new post. And is it possible ...
1
vote
1answer
38 views

How blog page in WordPress works : blog page retrieve first post ID

I use WordPress Static Front Page Process to assign the Front Page and assign the Posts Page. So I have 2 pages : "front" (front-page.php) and "blog" (home.php). For the "blog" page, When I display $...
0
votes
0answers
10 views

how to add the number of each publication (article page product … and other) in the wordpress admin dashboard

I would like to know how can add a column in the administration of each page ... or other. by a pluguin or a hook. help me please it's urgent. if you did not understand me contact me I explain you.
1
vote
1answer
2k views

How to retrieve the content (with a specific ID) via ajax by clicking a link tag

I want to retrieve the content with the specific ID via ajax post method. For instance, if I click a link tag which has a specific post ID, the content of that ID will load into the post-data div....
1
vote
2answers
128 views

WordPress plugin Write User/staff ID as the same as the WordPress User ID

I have a question in regards to a WordPress plugin (Bookly) that creates a Staff ID for an already created WordPress user, and hopefully, somebody may be able to help me with. Currently Bookly adds ...
0
votes
2answers
67 views

Show ids of displayed media library items

When I filter media library to display only the images I want to include in a gallery (by a shortcode needing images id), it would be very useful if Wordpress showed somewhere a list of the ids of the ...
1
vote
1answer
262 views

Create unique alphanumeric ID on wp_insert_post

I need a random (and unique) alphanumeric ID for permalinks and for post relation between a multisite installation. My idea is to generate this ID on wp_insert_post and save it as custom field value ...
0
votes
1answer
276 views

How to make Dynamic Page Template based on Post ID's

I am trying to make download page with download link defined in posts custom field. I want download pages to look like /download?p=id I found many sites using this kind of download links. Is there ...
0
votes
0answers
31 views

Find post/blog page ID - where to put code?

I am trying to find the ID of my posts page (the dynamic page that always displays the latest post on top). I found out that I need to include this code in index.php: <?php $page_for_posts = ...
0
votes
1answer
122 views

create front-end users post list by specific category

I am trying to create a post list that will show current users posts by specific category and show the post id inside the title. So, I wrote the code below, but it isn't working work. Any suggestions ...
1
vote
1answer
180 views

Cannot get grandparent object

I'm using the following code in order to get the ID of the current page's grandparent and great grandparent: <?php $current = get_post($post->ID); $grandparent = $current->post_parent; ...
0
votes
1answer
43 views

Crazy Question - Updating Post ID

I know this is a little bizarre but is there a function that can update/modify a post_id automatically when a user updates a post? I know there are functions to update publish dates automatically but ...
1
vote
1answer
24 views

How to check the array of featured images IDs

I'm trying to show some specific text on top of the featured images depending on their IDs. Some of the featured images will have the same text. $post_thumbnail_id = get_post_thumbnail_id(); if($...
0
votes
1answer
15 views

How to use url formatter with integer

I have this below code to prevent users from deleting the quizzes. if( in_array( $pagenow, array('admin.php') ) && ( $_GET['page'] == 'wpProQuiz' && $_GET['action'] == '...
0
votes
0answers
124 views

Filter by one custom field id, sections by it's value's range, CMB2

I have a custom post with some different fields and I need to filter them with respect to one field's(price) value in a way that users can search for different price range either with fixed categories ...
1
vote
0answers
278 views

Open post-content in archive page in a Modal box with bootstrap

on my archive page, i m trying to display the post content in a modal box ( using bootstrap). I manage only to display the first post in a modal box, nothing happen if I click on the other posts from ...
0
votes
1answer
81 views

How can i take all ids from untrash_post action?

When the user chooses to restore a post ( from "Trash" folder ) with the following way, through the action untrash_post, i get the id of the posts. function my_untrash_post_type( $post_id ) { ...
0
votes
1answer
41 views

Display result as “prefix+ID” and show in the search result as bookcode

I created a CTP and: When display a post ID inside the loop (example "112"), I also want to add a prefix like "CFX" and display result as string "CFX+IDnumber" (example: CFX112) and use it for ...
0
votes
1answer
146 views

Author Page User id in functions.php for non login user

I would like to access author id when a visitor come to author page? when I am coding in author.php file, I could print author id like below $q_obj = get_queried_object(); $user_id = (int) $q_obj-&...
1
vote
0answers
28 views

Post ID randomly printing on page

I'm getting and looping through some custom post types, and have no idea why the post ID is printing to the page--I have been looking at this forever now! My code is: $args=array('post_type'=>'...
1
vote
1answer
1k views

Get widget Title from widget id

Is there anyway at all to get the title of a widget from the widget id? The post title can be used by using get_the_title() Is there a way to get the title for a widget using the same kind or ...
0
votes
2answers
948 views

how would i change post->ID to work correctly when querying pages?

i am building the following script to query data from every child page of a certain page. i have it working fine, but i am unable to get the featured image, because i am using $post->ID. what would ...
1
vote
0answers
103 views

Search results posts_orderby and ID

I'm using this function for customizing search results: function order_search_by_posttype( $orderby ) { if( ! is_admin() && is_search() ) : global $wpdb; $orderby = "CASE WHEN ...
3
votes
1answer
660 views

get_attachment_id() only get id of first attached image after post update

i use the code explained here to get id of attached images to a post in a custom post type from $value that contains url of image (images already uploaded & exist in Media Library). the post ...
0
votes
1answer
268 views

Is it possible to restrict access to specific pages in the admin area based on the page slug?

I would like to restrict access to specific pages in the admin area to only the admin role (and / or specific users). There appears to be no shortage of answers on how to do this using the page ID's - ...
0
votes
1answer
65 views

How do I apply a wordpress function to something with no ID inside an archive page?

Inside of an archive page I have multiple boxes. In those boxes I want to add a star rating, but I don't want to create a separate post for each of these boxes, I only want to make the boxes manually. ...
1
vote
1answer
3k views

Getting current post ID in functions.php

I need to get the current post ID into an array in my functions.php. function filter_query( $query ) { $query['post__not_in'] = array(7); return $query; } add_filter('wpc_query', '...
1
vote
2answers
102 views

Making audio playlist by getting page's parent's ID

So right now the site automatically creates pages when a post is updated. I want this page to include an audio playlist. So what I do, is simply add the shortcode: [playlist]. Then, when the audio ...
0
votes
2answers
1k views

How to get widget content in Wordpress based on it's ID?

I need to parse widget content based on it's ID. But a widget works like a function that pulls data based on it's arguments, right? So when I pull the widget data, I can only get it's arguments, not ...
2
votes
1answer
237 views

Get Post ID with insert/edit link

Hi I want to get the post ID from the post selected in the insert/edit link button. I would normally do: <a data-id="<?php echo $post->ID; ?>" href="<?php the_permalink();?&...
0
votes
0answers
98 views

Checking Page ID before Wordpress executes queries

I'm using a plugin called Restricted Site Access to force users to log in before having access to my website. However, I'd like to allow unrestricted access to a specific page. According to the ...
0
votes
1answer
48 views

Possible to create a new post and have the Title and Slug automatically use the post's ID?

For a given Custom Post Type, I'd like that every time I create a new post (by using the Dashboard, clicking the button "Add new"), that the slug and Title assume this post's ID. I belive that the ID ...
0
votes
1answer
505 views

How can I get the page url slug when 'post_name' returns an id?

I have the following code: $menu = get_term( $locations[$theme_location], 'nav_menu' ); $menu_items = wp_get_nav_menu_items($menu->term_id); foreach( $menu_items as $menu_item ) { $link = $...