doubi4617 2016-03-24 09:20
浏览 43

无法获取自定义字段值

We're using custom fields to send data onto the required php template pages. Anyways all is working fine. We are using revolution slider for the slider and showing slider aliases as options in the custom field to pick when we're editing posts, events, pages etc..

The slider choice they're picking is then sent to the header, where we are loading the revolution slider shortcode. Its a quire simple mechanism.

However, the slider short code custom field is sending its value from ALL pages, posts except for the the event-categories. its a custom taxonomy.

in the header.php of the theme, I have a variable that gets the custom field's choice value using the following function:

    get_post_meta( get_the_ID(), 'mycustomfield', true );

I'm assuming that its getting the meta from posts, pages and everywhere else except for the taxonomy term.I'm guessing i will have to create a new variable and use a different expression to get the custom field's data. So can you help me with this please?

Any help is highly appreciated.

Thanks!

  • 写回答

2条回答 默认 最新

  • doutu6616 2016-03-24 09:55
    关注

    Have you actually checked your database to see where the custom field value is stored? Because if it is a custom taxonomy, you cannot get the value using "get_post_meta". You will have to use something like wp_get_post_terms.

    I had a lot of confusion regarding this. Only way to be certain, is to check the database and see where the value is being stored: wp_postmeta or wp_term*.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大