The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
10 views

List sub pages with custom field content converting image ID to URL

I am using the ACF plugin to create static (non-ecommerce) product pages. I am now making a page that lists all the sub pages with product name and the image added to the product_logo custom field. I ...
0
votes
1answer
505 views

Give a unique ID while saving

I have in my theme custom post types (products) with some meta-boxes. My client asked me, to automaticly give a unique SKU (meta-box) while saving that product. My thought: Give a random ID => ...
0
votes
1answer
480 views

get_post_meta fields don't show up on posts page

I'm new here, and to coding! I've been working hard (so, so hard...so hard) to create my website and with occasional help I've created a look and feel I like using some custom get_post_meta fields for ...
1
vote
1answer
407 views

Exclude main blog from get_blogs_of_user

I use WordPress Multisite and in the sidebar i have a box that shows a list of blogs the logged in user is a member of. I'm looking for a way to exclude the mainblog from this list. The main blog ID ...
0
votes
1answer
35 views

echo esc_url( get_permalink($post->ID) + complete the ID's url

I am in a deep trouble I try to only display the content of a post after clicking a bouton in order to not have the header and the footer again. Manually I have downloaded the plugin "Show Content ...
3
votes
3answers
3k views

Post ID At The End Of Permalink URL Effects Performance (Positively)?

HARD NOTE: This question is solely about performance, and NOT search engine optimization. So, please make sure your answers are as such. W.r.t permalinks, "year" is the most obvious numeric of ...
0
votes
1answer
23 views

Search by Attachment ID

I'm building a stock photo page for my company where we upload all photos our staff created so that it can be used later. It shows the ID of the image by post->ID so that users can see it, note it and ...
3
votes
3answers
5k views

Get user id from email?

I'm working on an email system, and I'm onto the unsubscribing stage. Since most of my users would not know their user ID, I'm asking them to put their email into a text box (definitely preferred, ...
1
vote
1answer
32 views

How to get ID of images used in gallery?

How to get ID of images used in gallery? Using $gallery = get_post_gallery_images( $post ); I only get a string with thumbnails url, without image ID which is needed for basically everything. ...
0
votes
0answers
297 views

Generate auto seqential ID number when a new user is registered

First off I found this solution to what I would like to do: generate an auto incremented id number when a new user is registered It is almost there but I would like to extend the functionality a ...
-1
votes
1answer
30 views

Custom post page has attributes of latest post [closed]

When you share the custom post page, it shows title, description, author of latest post. Even page ID is from latest post. Does it supposed to work like that? Besides this, it causes many other ...
1
vote
1answer
52 views

pass user id in slug and get user information

I have user id and I am getting all information using user id on page with slug. When I pass the user id in slug then I am not getting user information on page. For example I have ...
0
votes
1answer
13 views

Surrogate ID for posts, is there an alternative field in the posts table?

I am copying some content between another CMS and Wordpress. I need to keep track of the original Id because I might have to update the copied content in the future. The old CMS will still be used for ...
0
votes
1answer
1k views

generate an auto incremented id number when a new user is registered

First off I found this question: generate unique number when registering a user which is almost exactly what I need except I need the number generated to be auto incremented instead of random. I'd ...
0
votes
1answer
68 views

How to get specific page screen ID

Is it possible to get the screen id of a specific page? I've search on google and couldn't find anything related to specific page screen ID I'm not looking for the get_current_screen() ID or the ...
0
votes
1answer
32 views

Why I can not I use the variable outside my function?

I am writing a little plugin, to extract the post ID and them use it for some queries. Of course if I write: function my_callback_function() { $aa = 'hello world!'; echo $aa; } ...
1
vote
2answers
90 views

Transient unique names

What would be the correct way to assign a different name to each transient for each instance of a plugin used as a widget or shortcode?
1
vote
2answers
669 views

Get a post_id where meta_value equals something in a serialized meta_value field

I'm storing CPT products' post IDs into CPT companies' post meta (meta_key = prefix_products). As a company can have multiple products, so I'm storing them into a PHP serialized array value. ...
0
votes
0answers
64 views

How to pass multiple page ids from a custom field variable into post__in wp_query

I have a client that wants to pull content from multiple pages using page_ids listed in a custom field (363, 87, 95) without interfering with the main loop content (can't use sub-pages as same page ...
0
votes
1answer
45 views

Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?

I have a set of absolute URLs that have been used to refer to my site (they come from redirects in an old .htaccess file in this case). All of these URLs do resolve to some page or post on the site. ...
3
votes
2answers
3k views

How to obtain the user ID of the current profile being edited in WP-Admin?

Is there a way of obtaining the user ID of the profile being edited in wp-admin? I know it's in the URL if you are editing a user, EX: ./wp-admin/user-edit.php?user_id=427. Could always ...
-1
votes
2answers
30 views

get_pages gives wrong ID for blogpage

I have a problem with get_pages. It displays the wrong ID for the blog page. I have tried this code. $pages = get_pages(array("echo" => 0)); foreach($pages as $page){ echo $page->ID; } ...
4
votes
2answers
175 views

What is an alternative to get_page_by_title()?

I'm coding a theme where I want to display information in the footer that's only available on a template page. I have been using get_page_by_title() which works well if you know what the page will be ...
0
votes
1answer
246 views

WP_Query custom field pass the post id

I'm using WP_Query with ACF(Advanced Custom Fields) I'm building a news portal, and I'm trying to pass related stories from 1 post which is top_story = true. In another WP_Query I want to print the ...
0
votes
1answer
36 views

retrieve permalinks of posts inside custom post type by using post ID

I have these custom post types registered as shown in the image below - In each of these custom post types, there are many posts. I have the function to retrieve the post IDs of each posts inside ...
0
votes
1answer
36 views

Buddypress activity id

I am working on buddypress activity loop. I want to get current activity id or all activity parameters in entry.php file. but i am not able to get activity id. I am trying to use ...
1
vote
2answers
322 views

Importing posts from old website to new conflicting post ID's?

I am wondering when I am importing posts from my old site into my new website, which has already some posts in it. Do the imported posts get a new ID or do they overrule the existing posts ID's?
0
votes
2answers
652 views

Get the current post ID as a variable in Javascript

I'm trying to echo the post ID in a post Javascript and not having any luck. var post_id = '123'; // works fine var post_id = '<?php global $post; echo $post->ID; ?>'; // echos 'ID; ...
0
votes
1answer
28 views

Associating special meaning with user id 0

I'm writing a plugin that creates a custom table holding data which is linked to a user account with a user_id field. Now if that users account would be deleted for any reason I would like to set that ...
6
votes
5answers
472 views

Are post ID's reliable?

I understand that post ID's are unique, but are they reliable as persistent data ID's? More specifically, is there a guarantee that, through a migration or another data exchange, post ID's will not ...
0
votes
2answers
120 views

Are all ID's used unique?

I'm using JSON api plugin to pull data from wordpress into an app I am making. I need a unique identifier to make sure I don't have any duplicates WHILE also using the identifier as a way to sort from ...
0
votes
0answers
16 views

Reverse Locate Gallery by ID - NOT ID but location on website!

This has befuddled me a few times and my searches only tell me how to find the ID of a gallery which I know. I am helping a friend with her Wordpress blog, I did not set up the site and I see she has ...
0
votes
1answer
76 views

Get the correct post id for all post and page in header.php

I want to get the current post/page id outside the loop (in header.php) and use this id for Advanced Custom Fields plugin to get the fields. But i cant get the correct id from front page, archive ...
5
votes
2answers
17k views

get all posts ID from a category

Problem: I need to get an array of ID's of posts from a given category If the category have any posts. This is to be used on a plugin options page. So far I have: $posts = ...
0
votes
1answer
22 views

Retrieve ONLY mp3s and set a variable for use in a playlist called by single.php template?

I'm trying to stuff a variable called $work_ids with the ID of any attached MP3 files for use in a custom player (based on MediaElement.js if that matters). The library contains WAV and other versions ...
0
votes
0answers
20 views

Sort products by products ID

is there a way to define an url like this one: http://www.mydomainname.com/product ID 1234 and product ID 5678 If yes which should be the correct syntax. Thanks for the help Roc
0
votes
0answers
59 views

Getting wrong ID

I have a page template with a custom query. The query displays posts from a post type. I want to display the ID's of the queried posts, but when I use this... <?php $id = the_ID(); ?> All I ...
2
votes
2answers
183 views

Is post ID number always incremental n+

I have one question. Will WordPress always assign new post post ID which is incremental n+? For example if I delete some posts, will WordPress use ID of deleted post for new post added in future?
0
votes
1answer
22 views

CPT posts in drop downed in meta box on page doesn't return post ID

I have an issue with displaying ID of selected post. Could you guys help? thanks Function below add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( ...
0
votes
2answers
117 views

How to get home page ID?

I'm building a Wordpress plugin in which I need to get the HOME page ID value. Do you know how can I get it? I know that we can get the current ID with the_ID() or get_the_ID() function, but I need ...
-2
votes
1answer
40 views

how can i get the page_ID in nav li [closed]

I need a menu with the page IDs of the linked Pages in the li Tags. It should look like that: <ul id="menu"> <li class="pageid_23"><a href="page1">Page 1</a></li> ...
6
votes
1answer
4k views

Get page IDs from nav items

I am trying to get all the IDs in my navigation and convert it to a string so that I can use it with wp_query to get the pages that are only listed in the nav. The code to get the IDs: $menu_name = ...
1
vote
2answers
382 views

Get All IDs Of A Post Type Using WP_Query

I am trying to get a list of a custom post type's IDs using WP_Query, but it is returning undesired result, which is a memory leak and stuck browser. Here is the code I use: $the_query = new ...
2
votes
1answer
42 views

Does the menu item ID ever change?

Does the ID Wordpress gives each menu item ever change? id="menu-item-1234" I've linked to it within my CSS, however this will be no use if this ID may change, for instance when the page is ...
0
votes
3answers
50 views

Custom post type returns bad post ID

I added custom post type and I have first problem. I don't know why but if I use $post->ID, independently of post ID it always gave me the same value. I'm using this function <?php the_post(); ...
0
votes
1answer
2k views

How do I display Youtube/Vimeo video ID on custom post type when user enters it in custom meta box?

I have created a 2x shortcodes that displays a youtube video and vimeo video when the user enters the videos id in it, for example: [youtube id=""] [vimeo id=""]. Instead of entering this in my post ...
0
votes
2answers
136 views

Is it possible to have dynamic post id # in add_menu_page()?

I use the add_menu_page function in my custom theme builds but when I export my local copy of the site and import it in the production site some of post id numbers change and I have to update this ...
0
votes
1answer
81 views

Set post tags using tag ID

I want to set post tags to a new value. Is there a way to use the tag ID to do it? The wp_set_post_tags only accepts the tag name or an array of tag names. <?php wp_set_post_tags( $post_ID, $tags, ...
1
vote
1answer
2k views

Can't get post ID in functions.php?

I need the current post id in a function , which I have written in functions.php. But I can't get the id . I have tried several method . Like get_the_ID() ; ----returns false global $post; ...
0
votes
1answer
87 views

Generate unique number when registering a new user

I know there are userID, username in the database, but I want a formatted and unique number for physical world use. For example: "2014xxxx" 201414:year,xxxx:generate randomly when registering a user. ...